This app includes:
- Signup
- Login
- Forgot Password
- Reset Password
In this app JWT JSON WebToken is used for User Authentication (Node.js using Hapijs), Joi for user input validation, mongoose for ORM, Nodemailer for sending an email to user, Winston for error logging, Boom for returning error response object.
npm install
Create .env file on root directory and add the below code
SECRET = AIzaSyAQfxPJiounkhOjODEO5ZieffeBv6yft2Q
PORT = 8000
MONGO_URI = mongodb://localhost:27017/hapiapp
NODE_ENV = development
EMAIL_ID = [email protected]
EMAIL_PWD = example
npm start
POST: http://localhost:8000/auth/signup
{
"firstname": "Jitendra",
"lastname": "Kumar",
"email": "[email protected]",
"password": "123"
}
POST: http://localhost:8000/auth/login
{
"email": "[email protected]",
"password": "123"
}
POST: http://localhost:8000/auth/forgot
{
"email":"[email protected]"
}
POST: http://localhost:8000/auth/resetpassword/{token}
{
"password": 123
}
[Express app] (https://github.com/contactjittu/expressapp)