/basic-auth-nodejs

Basic Auth with JWT.

Primary LanguageJavaScript

Express Exercise with Authentication

  1. Create a basic Nodejs server
  2. Use Nodemon for watching changes.
  3. Create basic Routes for the authentication
    • 3.1 POST - Login
    • 3.2 POST - Register
    • 3.3 GET - Private (Just for authenticated users)
  4. Register the users using their username and password.
    • 4.1 Hash the password using bcrypt
    • 4.2 Use JOI for validating the user schemas.
    • 4.3 Use Boom for error handling.
  5. Read about JWT
    • 5.1 Create an JWT once the user has enter his username and password succesfully.
    • 5.2 Use Passport and PassportJWT as the main auth middleware.

Note: Use Postman or an alternative for consuming APIs.