Skip to content

ayushgoswamiabr/Auth-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Auth App

Created a NodeJS app and user can send get request to this link https://auth-app-mern.herokuapp.com/api to get a greeting message

Password

Created a Database in MongoDB and connected it to the application using mongoose, API to register user is created and user can create account by sending POST request to this link https://auth-app-mern.herokuapp.com/api/signup, the body should contain firstname,lastname,email,phone,address,password in json format, the email should be valid and the pasword should be minimum 8 characters. If the user already exists then API responds with message User Exists

Passwords are stored in database in hashed format

Created an API to log in user, user can send POST request to this link https://auth-app-mern.herokuapp.com/api/login to login, the body of the request should contain email and password and the email should be valid, if the password is incorrect then the API responds with message Password is incorrect. If email and password is correct then it responds with the json web token created using mongo db id of the user

Created an API which takes json web token as header and validates it and if it is valid then it responds with the profile data of the user (specifically firstname, lastname, email, phone and address). This API can be accessed through making a GET request in following link https://auth-app-mern.herokuapp.com/api/profile

Created a Signup route in react APP which takes firstname, lastname, email, phone,address and password from the user and then makes a POST request to API to create a new user. The form has all the validation it also checks whether the email is valid or not and if the password it minimum 8 characters or not and it all the data is correct it gives message to the user that the user is created successfully and if the email already exists it gives error to user that the email already exists. This route can be accessed by this link https://auth-app-mern.herokuapp.com/signup

Created a login route which accepts email and password from user and validates the email and if the email is valid then makes a POST request to the API to validate the credentials given by user,if credentials are valid then it responds with json web token, Json web token is then stored in the local storage to manage login session. If the password is incorrect then it gives error to user. This route can be accessed by https://auth-app-mern.herokuapp.com/login

Created a Profile Route which can only be accessed if the user is logged in and has a valid json web token. This page displays the information of user which is stored in Mongo DB like firstname, lastname, phone, address and email. This route can be accessed by https://auth-app-mern.herokuapp.com/profile. If the user is not logged in it redirects to login page

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published