Content sharing blogs that allow users to create cross-category posts. Every post can contain photos, files, and text. Blogie supports likes, comments, save and sharing posts. Every user can set what categories preferences to be displayed on the homepage.
- Please copy example.env file
- Rename file to .env
- Insert your database credential and port to run this application
- Cloning this repository to your local computer.
- Install all dependencies using command:
npm install
- Create database using command:
sequelize db:create
- Migrate database schema using command:
sequelize db:migrate
- Seed data dummy using command:
sequelize db:seed:all
- Run this application using command:
npm run dev
or
npm start
- Create branch feature from branch deploy with format:
feature/(feature-name)
How to create branch?
- Gitlab
Choose icon plus beside list branch and choose this repository new branch. - Visual Studio Code
Ctrl+Shift+P and then search git:create branch.
- In visual studio code, checkout to new branch using command:
git checkout feature/(feature-name)
- Make change to your code.
- After that, move modified files to staging area using command:
git add .
- Make a note of all changes using command:
git commit -m "(your change log)"
- Push your commit to your branch using command:
git push origin feature/(feature-name)
- After your feature done, go to repository gitlab and choose create merge request.
- Add title.
- Describe your changes in description column.
- In Assignees, choose assign to me.
- In Reviewers, choose your tech lead.
- Submit merge request
- If there is a problem or code need fixing, tech lead will create comment in your code or create comments in your merge request.
- Update your branch using command:
> git fetch - Pull update your branch using command:
> git pull - Fix your code
- Make a note of all changes using command:
> git commit -m "(your change log)" - Push your commit to your branch using command:
> git push origin feature/(feature-name) - Go to gitlab and create comment with tag to your tech lead to inform you already fix your code
- Update your branch using command:
- If there is no problem, tech lead will create comments LGTM (Looks good to me) to your merge request.
- Your merge request will be closed
- bcrypt
- dotenv
- ejs
- express
- faker
- jsonwebtoken
- nanoid
- passport
- passport-jwt
- pg
- sequelize
-
Feature signup
endpoint:POST
/signup
request example:
{ "email": "sherlockholmes@gmail.com", "password": "1234567890", "username": "sherlockholmes", "fullName": "Sherlock Holmes", "image_profile": "profile.jpg", "image_header": "header.jpg", "about": "Hi, it's me.", "occupation": "Web Developer", "location": "Indonesia", "role": "User", }
success response example:
{ "status": "200 OK", "message": "User has been register", "data":{ "id": "EqpcETTeyVJqTI7ReTL9Z", "email": "sherlockholmes@gmail.com", "username": "sherlockholmes", "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IkVxcGNFVFRleVZKcVRJN1JlVEw5WiIsImlhdCI6MTYxNDQ4OTk0Nn0.-cZuPQQ2N4kQkAGtZJk0WTXHRmNYymaqdL2wIRmLiFc" } }
error response example:
{ "status": "409 Conflict", "message": "Username/Email already exists" }
-
Feature Login
endpoint:POST
/signup
request example:
{ "email": "sherlockholmes@gmail.com", "password": "1234567890" }
success response example:
{ "status": "200 OK", "message": "Login successful", "data":{ "id": "EqpcETTeyVJqTI7ReTL9Z", "email": "sherlockholmes@gmail.com", "username": "sherlockholmes", "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IkVxcGNFVFRleVZKcVRJN1JlVEw5WiIsImlhdCI6MTYxNDQ4OTk0Nn0.-cZuPQQ2N4kQkAGtZJk0WTXHRmNYymaqdL2wIRmLiFc" } }
error response example:
{ "status": "401 Unauthorized", "message": "Email/Password incorrect" }
-
CRUD User
Create User
endpoint:POST
/users
request example:
{ "email": "sherlockholmes@gmail.com", "password": "1234567890", "username": "sherlockholmes", "fullName": "Sherlock Holmes", "image_profile": "profile.jpg", "image_header": "header.jpg", "about": "Hi, it's me.", "occupation": "Web Developer", "location": "Indonesia", "role": "User", }
success response example:
{ "status": "200 OK", "message": "User has been register", "data":{ "id": "EqpcETTeyVJqTI7ReTL9Z", "email": "sherlockholmes@gmail.com", "username": "sherlockholmes", "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IkVxcGNFVFRleVZKcVRJN1JlVEw5WiIsImlhdCI6MTYxNDQ4OTk0Nn0.-cZuPQQ2N4kQkAGtZJk0WTXHRmNYymaqdL2wIRmLiFc" } }
error response example:
{ "status": "409 Conflict", "message": "Username/Email already exists" }
-
CRUD Post
-
CRUD Category
-
CRUD Comment
Create Comment
endpoint:POST
/comment/
request example:
{ "content": "i have no idea." }
success response example:
{ "status": "200 OK", "message": "Add Comments successful", "data":{ "id": "U1g-lBI6BHhgHu5IfAC2I", "posts_id": "o19vozmrZ_yVBa6hV_g0Q", "users_id": "EqpcETTeyVJqTI7ReTL9Z", "content": "i have no idea.", "createdAt": "2021-02-27T10:11:40.406Z", "updatedAt": "2021-02-27T10:11:40.406Z" } }
error response example:
{ "status": "403 Forbidden", "message": "You need to login first" }
Read Comment
endpoint:GET
/comment
GET
/comment/:id
success response example:
{ "status": "200 OK", "message": "Read comments successful", "data":{ "id": "U1g-lBI6BHhgHu5IfAC2I", "posts_id": "o19vozmrZ_yVBa6hV_g0Q", "users_id": "EqpcETTeyVJqTI7ReTL9Z", "content": "i have no idea.", "createdAt": "2021-02-27T10:11:40.406Z", "updatedAt": "2021-02-27T10:11:40.406Z" } }
error response example:
{ "status": "404 Not Found", "message": "Comments not found" }
Edit Comment
endpoint:PUT
/comment/:id
request example:
{ "content": "i have idea." }
success response example:
{ "status": "200 OK", "message": "Edit comments successful" }
error response example:
{ "status": "400 Bad Request", "message": "Comments can't be empty" }
Delete Comment
endpoint:DELETE
/comment/:id
success response example:
{ "status": "200 OK", "message": "Delete comments successful" }
error response example:
{ "status": "404 Not Found", "message": "Comments not found" }
-
GET Saved Post
-
GET Search Post Title/User
-
GET Post by Category
-
GET Post by (latest activity)
-
GET Users by Following’s Followers (suggestion)
-
GET Post by Active User
-
PATCH User (User’s side)
-
GET Saved Post by Month
-
GET Saved Post by Week
-
GET Post by Post’s Likes
-
GET Post by CreatedAt
-
GET Post by id
-
CREATE Post (user’s side)
-
GET Post user by Interest