Live Demo: Click here (Frontend)
Backend: Click here
-
Clone from git URL and goto project folder
git clone https://github.com/anasvakyathodi/node-project-the-pulse-gate-suite.git
cd node-project-the-pulse-gate-suite.git
-
Install dependencies
npm install
-
Run the app in development mode
npm run dev
-
Open http://localhost:5000 with your browser to see the result.
-
Create User
Request Type: POST
http://localhost:5000/users/register
Body:
{ "email": "example@gmail.com", "password": "example", "passwordCheck": "example", "displayName": "example", "userType": "author" // or admin }
Response:
{ "status": "Success", "msg": "Successfully Registered!" }
-
Login
Request Type: POST
http://localhost:3000/users/login
Body :
{ "email": "example@gmail.com", "password": "example" }
Response :
{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXV....", "user": { "id": "61f274fe516f27644f8383c7", "displayName": "example", "userType": "admin" } }
-
Logout
Request Type: POST
http://localhost:3000/users/logout
Header :
{ "Authorization": "token-string" }
Response :
{ "status": "Success", "msg": "Successfully Logged Out!" }
-
Fetch Articles
Request Type: GET
http://localhost:3000/articles/
Query:
{ "limit": "<number>", // rows per page "page": "<number>" // page number }
Header :
{ "Authorization": "token-string" }
Response :
{ "status": "Success", "data": [ { "_id": "article id goes here", "title": "Article 1", "content": "content 1", "authorId": "user-id", "authorName": "example", "submissionTime": "Date ", "status": "rejected", // or "accepted" or "no action" "remarks": "remark", // or null "__v": 0 } ], "count": 16 // total number of articles }
-
Create an Article
Request Type: POST
http://localhost:3000/articles/create
Body:
{ "title": "<name>", "content": "<content>" }
Header :
{ "Authorization": "token-string" }
Response :
{ "status": "Success", "msg": "Successfully Created" }
-
Update an Article
Request Type: PATCH
http://localhost:3000/articles/update
Body:
{ "id": "<article id>", "title": "<number>", // either title or content or both "content": "<number>" }
Header :
{ "Authorization": "token-string" }
Response :
{ "status": "Success", "msg": "Successfully Updated" }
-
Review an Article
Request Type: POST
http://localhost:3000/articles/review
Body:
{ "id": "<article id>", "action": "action", // either "accepted" or "rejected" "remarks": "<any other remarks / suggestions>" // optional }
Header :
{ "Authorization": "token-string" }
Response :
{ "status": "Success", "msg": "Successfully Submitted" }
- Node JS
- Javascript
- Mongoose
- Mongo DB Database
Server is Deployed on Heroku