Using Node.js, Express & MongoDB created a Back-End Application for accounts auth functions - that responsible for log in and sign up and reseting password and using the jwt token authentication with refresh token for doing the basic accounts functions like updating accounts and deleting the first user is registerd in the database set to the admin role and the others will be only users and after that the admin can change the roles of the users. a documentaion added to the route localhost:5000/api/auth/docs using swagger the main server side work on local url localhost:5000/api/auth
- Node.js - Runtime environment for JS
- Express.js - Node.js framework, makes process of building APIs easier & faster
- MongoDB - Database to store document-based data
- Mongoose - MongoDB object modeling for Node.js
- JSON Web Token - A standard to secure/authenticate HTTP requests
- Bcrypt.js - For hashing passwords
- crypto- to generate refresh tokens
- Dotenv - To load environment variables from a .env file
- cookie-parser - to fetch a refresh token from cookies
- joi - for basic request validations
- nodemailer - for sending verifacation emails using SMTP
- swagger-ui-express -a living documentation for your API hosted from your API server via a route
- yamljs-Standalone JavaScript YAML 1.2 Parser & Encoder. Works under node.js and all major browsers. Also brings command line YAML/JSON conversion tools.
- ethereal.email- a mock up smtp
- Authentication (login/register with email-password)
- refresh token
- revoke token
- update account
- forget password
- reset password
- delete accounts
- get all users only for admins
- a living documetaions for api
Setup:
- replace the config-example.env with your config.env file
- run
npm i && npm run server
to start the app - you can see documentation on the url localhost:"yourport"/api/docs
- if you want to see emails that the programm send pleas go to (https://ethereal.email/login) and log in as user: rebecca.sanford17@ethereal.email and pass: 9ehZN56ka9QhyZM9ex