Hacktiv8 Pair Project as Final Project on phase 1 using expressjs, ejs, sequelize, herokuapp
Accessing the web by using this link https://sosialisasi.herokuapp.com
Run commands below :
git clone https://github.com/harfialpharaby/socialize.git
git checkout -b <new-feature-development>
Run the following commands :
npm init
sequelize db:create
sequelize db:migrate
GET /feeds/add
data = req.session
POST /feeds/add
req = {
body: {
title = <feed title>,
content = <feed content>,
tagsName = <tags list no space with comma delimiter>
}
}
GET /feeds/edit
data = {
feed = <getting feed by req.params.id>,
fullName = req.session.fullName
}
GET /tagged/:tagName
req = {
session: {
fullName = STRING<logged in user>,
userId = INTEGER<logged in user>
},
params: {
tagsName = ARRAY[STRING<searched tags>]
}
}
GET /like/:feedId
req = {
session: userId,
params: {
feedId: INTEGER<feed id>
}
}
GET /dislike/:feedId
req = {
session: userId,
params: {
feedId: INTEGER<feed id>
}
}
GET /users/register
POST /users/register
req = {
body: {
{
first_name: STRING<firstName>,
last_name: STRING<lastName>,
password: STRING<password>,
email: STRING<email>,
username: STRING<username>,
profilPict: '161bbd1abc24d29e1abefd0f21ff90f8'
}
}
}
GET /user/page
req = {
session: {
userId: INTEGER<user id>,
fullName: STRING<user full name>
}
}
GET /otherpage/:id
req = {
params: {
id: INTEGER<other user id>
},
session: {
fullName: STRING<logged in user full name>
}
}
GET /users/edit
req = {
session: {
userId: INTEGER<logged in user id>,
fullName: STRING<logged in user full name>
},
data: STRING<req.query success='success message' or failed='failed message'>
}
POST /users/edit
req = {
first_name: STRING<new first name>,
last_name:STRING<new last name>,
old_password: STRING<old password to indentify the user>,
new_password: STRING<new password or null to unchange password>,
email: STRING<new email>,
username: STRING<new username>,
session: {
userId: INTEGER<logged in user id>
}
}
POST /users/profile
req = {
file: {
filename: STRING<new uploaded file image>
},
session: {
userId: INTEGER<logged in user id>
}
}
GET /tags
req = {
session: {
fullName: STRING<logged in user full name>
}
}
Validate logged in user to acessing other user page.
const checkIsUser = require('../middlewares/checkIsUser')
router.get('/otherpage',checkIsUser)
router.get('/otherpage/:id', UserController.otherPage)
Validate user is in login state so that user can access all logged in features.
const checkLogin = require('../middlewares/checkLogin')
router.use('/',checkLogin)
router.get('/page', UserController.userPage)
const redirectIfLogin = require('../middlewares/redirectIfLogin')
router.get('/', redirectIfLogin)
router.get('/', UserController.loginPage)
const hashingPassword = require('../helpers/hashingPassord')
hashingPassword(
STRING<random secret wether its auto generated or save on database for each data>,
STRING<plain password typed by user on browser>
)