a simple authentication api using express and mongodb
- Clone this repository
- Create a .env file in the root directory
- Specify your desired
API_PORT,MONGO_URI, andTOKEN_KEYin the .env file. TOKEN_KEYcan be any randomly generated string, it is used for signing JSON Web Tokens.- Run
npm run devin the terminal.
POST /register
Allows users to register by providing their email, password, user role, designation, company, first name and last name.
POST /login
Allows users to login by providing their email address and password. After successful login, the API returns a JSON Web Token (JWT) that can be used to authenticate subsequent requests.
GET /myinfo
Allows users to retrieve their own information, including first and last names, email address, role, designation and company.
PATCH /update
Allows users to update their own information, including first and last names, password, email address, designation and company.
DELETE /delete
Allows users to delete their own account.