https://github.com/skorotkiewicz/node-rest-api-jwt
Simple Node.js RESTful API with JWT Authentication and MongoDB
https://github.com/skorotkiewicz/node-rest-api-jwt
Last synced: 2 months ago
JSON representation
Simple Node.js RESTful API with JWT Authentication and MongoDB
- Host: GitHub
- URL: https://github.com/skorotkiewicz/node-rest-api-jwt
- Owner: skorotkiewicz
- Created: 2019-09-09T17:25:17.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-20T16:35:46.000Z (almost 5 years ago)
- Last Synced: 2025-01-31T12:34:24.527Z (4 months ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
RESTful API with MongoDB and JWT AuthenticationVery simple RESTful starter in NodeJS + MongoDB with JWT Authentication
## Getting started
1. Clone this repo using `https://github.com/skorotkiewicz/node-rest-api-jwt.git`
2. Move to the appropriate directory: `cd node-rest-api-jwt`.
3. Run `npm install` to install dependencies.
4. Set `.env` file with your mongoURI.
5. Run
5.1 `npm run dev` (nodemon)
5.2 `npm start` (without nodemon)## Basic usage
* Get all the posts
`GET http://localhost:3000/posts`* Get a specific Post
`GET http://localhost:3000/post/5ae63c5027bbe422cce696a3`* Register User
`POST http://localhost:3000/users/register`Headers:
- Content-Type: application/json
Body:
- name
- password___
* Authenticate User
`POST http://localhost:3000/users/authenticate`Headers:
- Content-Type: application/jsonBody:
- password
___
* Create new Post
`POST http://localhost:3000/action/create`Headers:
- x-access-token
- Content-Type: application/jsonBody:
- title
- description
___
* Update a Post
`PATCH http://localhost:3000/action/5ae63c5027bbe422cce696a3`Headers:
- x-access-token
- Content-Type: application/jsonBody:
- title
- description
___
* Delete Post
`DELETE http://localhost:3000/action/5ae63c5027bbe422cce696a3`Headers:
- x-access-token
- Content-Type: application/json