This is a Nodejs
project that provides APIs for authentication and authorization. It uses MongoDB
as the database and JWT
for authentication.
- User Signup
- User Signin
- User Update
- User Delete
- Get all users
- [] User Logout
- [] User Forgot Password
- [] User Reset Password
- Clone the repo
cd Authentication_APIs
npm install
- Create a
.env
file in the root directory and add the following environment variables
SERVER_PORT
MONGO_USERNAME=
MONGO_PASSWORD=
LOGGING_FLAG=true
JWT_SECRET=
JWT_EXPIRY_TIME=
npm run dev
npm run dev
to start the server in development modenpm run build
to compile into javascriptnpm run start
to start the server (dist/ js code) in production mode
Method | Endpoint | Description | Payload |
---|---|---|---|
POST | /auth/signup |
User Signup (Public) | name, emai (unique), password, role (admin, student, teacher) |
POST | /auth/signin |
User Signin (Public) | email, password |
PUT | /auth/update/:id |
User Update | _id (in params), fields to be updated (in body) |
DELETE | /auth/delete/:id |
User Delete | _id (in params) |
GET | /auth/user/:id |
Get all users | _id (in params), |
GET | /auth/all-users |
Get all users | |
GET | /video |
Sample role based route |
- Logging using
chalk
: custome logging (winston etc not used, may be required in future) - Organized file structure (routes, controllers, models, services, utils, config)
- Error handling