This project uses Node.js & MongoDB to support basic User Authentication (Registation, Login) & Authorization with JSONWebToken (JWT).
Read more about session-vs-token-based-authentication.
- bcryptjs
- express
- jsonwebtoken
- mongoose
In the project directory, you can run:
to setup the environnement
Runs the app in the development mode.
Open http://localhost:3001 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
User can signup new account, or login with email & password.
The user has access to protected resources or not based on his role (admin, supervisor or user)
NB: admin credentiels (email:azerty90@gmail.com, password:Az123456) were added manually to the db
Methods | Urls | Actions |
---|---|---|
POST | /api/signUp | signup new account |
POST | /api/signIn | login an account |
GET | /api/homeBoard | retrieve home board content |
GET | /api/adminBoard | retrieve admin board content |
GET | /api/supervisorBoard | retrieve supervisor board content |
GET | /api/userBoard | retrieve user board content |
PUT | /api/updateProfile | update profile (email only) |
GET | /api/getAllUsers | retreive all users (available only for admin and supervisor roles) |
GET | /api/getAllSupervisors | retreive all supervisors (available only for admin) |
GET | /api/getAllRoles | retreive all users (available only for admin) |
PUT | /api/addSupervisor | add supervisor role to a regular user (available only for admin) |
PUT | /api/removeSupervisor | remove role supervisor (available only for admin) |