A login RESTFul API that uses Node.js and the Express framework along with JWT for authentication
Features
- NodeJS
- Express
- MongoDB
- JWT
Requirements
Instalation
git clone https://github.com/ThiagoBastosN/LoginRESTFulAPI.gitcd loginrestfulapinpm install- Inside .env, change DATABASE_URI to your cluster URI
npm start- You may also want to add .env to .gitignore
At http://localhost:3000/ you'll have some route options.
GET routes
- http://localhost:3000
- /retrieveDb
- /main
- Requires authentication header and a token that comes in /login response, the format must be Bearer yourtoken
Notice that /main route requires authentication.
POST routes
- http://localhost:3000
- /register
- Body content:
{"username": yourusername, "password": yourpassword}
- Body content:
- /login
- Body content:
{"username": yourusername, "password": yourpassword}
- Body content:
- /register
