Skip to content

anasvakyathodi/node-project-the-pulse-gate-suite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Pulse Gate Suite (Backend)

Live Demo: Click here (Frontend)

Backend: Click here

Getting Started (for running on local)

  1. 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
  2. Install dependencies

    npm install
  3. Run the app in development mode

    npm run dev
  4. Open http://localhost:5000 with your browser to see the result.

Routes

User Routes

  • 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!"
    }

Article Routes

  • 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"
    }

Technologies Used

  • Node JS
  • Javascript
  • Mongoose
  • Mongo DB Database

Server is Deployed on Heroku

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published