Skip to content

Latest commit

 

History

History
140 lines (97 loc) · 2.73 KB

README.MD

File metadata and controls

140 lines (97 loc) · 2.73 KB

Jobs API

A restful Jobs API

Tech Stack

Client: No Frontend!!

Server: Node, Express, MongoDB

Run Locally

Clone the project

  git clone https://github.com/co-bby/jobs

Go to the project directory

  cd <projectname>

Install dependencies

  npm install

Start the server

 nodemon

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

These are examples

MONGO_URI= mongodb+srv://username:@cluster0.9t7ho.mongodb.net/Jobs-API?retryWrites=true&w=majority

JWT_SECRET= WfTkWnZq4t7w!z%C*F-JaMdKgUkXp2s5

JWT_LIFETIME= 30d

API Reference

Register

  POST /api/v1/auth/register
Req.body Value Remarks
username Unique username Required. Eg: Cobby
password New user's password Required User password from 6-20 characters
Email New user's E-mail Required.
Sucessful Response
{
  "user": {
    "name": username
  },
  "token": auth token
}

Login

  POST /api/v1/auth/login
Req.body Value Remarks
username Registered Unique username Required. Eg: Cobby
password Registered user's password Required User password from 6-20 characters
Successful Response
{
  "user": {
    "name": username
  },
  "token": auth token
}

Create a Job

POST /api/v1/jobs
Req.body Value Remarks
company company name . Eg Apple
Position job Position Eg Senior Engineer

To access to routes after login

req.headers.authorization Value Remarks
authorization header Bearer + " " auth token Eg: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI2M2M2OW

Get all Job

Get /api/v1/jobs

Get/Update/Delete a job

Get/Patch/Delete /api/v1/job/{jobID}