Skip to content

MERN JWT Auth Backend

Pre-release
Pre-release
Compare
Choose a tag to compare
@vishalnagda1 vishalnagda1 released this 02 May 11:42
· 103 commits to master since this release

MERN JWT Auth Backend

GitHub license Repository version

Release Notes:

  • Initialized the application using npm and installed necessary packages
  • Set up a MongoDB database
  • Set up a server with Node.js and Express
  • Created a database schema to define a User for registration and login purposes
  • Implement the user registration API.
  • Implement the user login API.
  • Set up three API routes, register, login, and currentuser using passport + jsonwebtokens for authentication and validator for input validation
Installed Packages:
  1. Install bcryptjs package to hash passwords before we store them in our database.
  2. Install body-parser to parse incoming request bodies in a middleware.
  3. Install concurrently to allows us to run our backend and frontend concurrently and on different ports.
  4. Install express so on top of Node it make the routing, request handling, and responding easier to write.
  5. Install is-empty as global function that will come in handy when we use validator.
  6. Install jsonwebtoken for authorization.
  7. Install mongoose to interact with MongoDB.
  8. Install passport to authenticate requests, which it does through an extensible set of plugins known as strategies.
  9. Install passport-jwt so passport strategy for authenticating with a JSON Web Token (JWT); lets you authenticate endpoints using a JWT.
  10. Install validator to validate inputs (e.g. check for valid email format, confirming passwords match).
  11. Install nodemon as dev dependency to track changes and restart the server.

Future Implementations:

  1. Implementation of React client app.
  2. Integration of redux for state management.
  3. Integration of Backend APIs in the react client.