Auth

File Name : auth.js File Path : /server/routes/auth.js Auth route contains checkUser, login and logout routes for user. Also routes can be added which require authentication. These functionalities are included in Auth Controller.

get
login

/api/auth/login
Request
Response
Request
Body Parameters
email
required
string
Email Id
password
required
string
Password
Response
200: OK
{
success: false,
message: "User not found with the given email id"
}
or
{
success: false,
message: "erro while finding user"
}
or
{
success: true,
message: "User successfully logged in"
data: {
jwtAccessToken: `JWT ${token}`,
user: userData
}
}
or
{
success: false,
message: "Incorrect password"
}

get
Check User Existence

/api/auth/checkuser
Request
Response
Request
Body Parameters
email
required
string
Email id
password
optional
string
password
Response
200: OK
{
success: true,
message: "New User"
}
or
{
success: true,
message: "User exists"
data: {
user: userData,
jwtAccessToken: `JWT ${jwtAccessToken}`
}
}

get
logout

/api/auth/logout
Request
Response
Request
Body Parameters
jwtAccessToken
required
string
Authorization
Response
200: OK
{
success: true,
message: "User logout successfully"
}
or
{
success : false,
message : 'User Not Found',
}