Routes - Admin
File Name : admin.js
File Path : /server/routes/admin.js
Auth route contains login and logout routes. Also routes can be added which require authentication. These functionalities are included in Auth Controller.
Login Route
- API Path: api/admin/login
- Method: POST
- Description: Login route verifies email and password for the user. Once a user is authenticated, a token is generated.
Parameters:
- Name: req
- Type: Object
Name In Type Required email req.body String true password req.body String true userType req.body String true Response: Returns an object with three properties: success (bool), message, data. The third parameterdata is an object with two properties: jwtAccessToken and user object.
- Http Code: 200
- Name: returnObj
- Type: Object
Name Type success boolean message string data Object
LogOut Route
- API Path: api/auth/logout
- Method: GET
- Description: This is a protected route which requires authentication token in the header. Logout route simply changes the login status and logouts the user from the database.
- Parameters:
- Name: Authorization
- In: Header
- Description: Contains JWT access token required to check the authenticity of the user who makes a API call.
Response: Returns an object with three properties: success (bool), message, data. The third parameterdata is an object with two properties: jwtAccessToken and user object.
- Http Code: 200
- Name: returnObj
- Type: Object
Name Type success boolean message string data Object