Node REST API that utilizes jwt authentication and has some pagination. The api persists data in a local mongo no-sql database.
- bcryptjs
- body-parser
- cors
- dotenv
- express
- helmet
- jsonwebtoken
- mongoose
- mongoose-paginate-v2
- morgan
- nodemon
- Run
npm install
to install all the required packages - Create a .env file and add:
- A
DATABASE_URL
path - A mongodb
DATABASE_NAME
- A free
PORT
number. The default port is 3000 - The
CONFIG
secret to sign jwt users
- A
- Run
npm start
to start the server - Head over to
localhost:3000/api/auth/register
to register a new user and you will receive a token which expires in 24 hours ! 😢 - Use the token with the header
api-key
to access the other routes