NodeJS app to handle leave application submission and approval.
The App involves APIs for two roles of users : Employee and Manager.
Run node start
or node server.js
http://localhost:8092/username
This returns json array of all the leave applications previously submitted. username is the username field from User collection.
POST request URL
http://localhost:8092/username
The request body must contain leave schema as:
{
startdate: String,
enddate:String,
leavetype:{type: String, enum :['Earned Leave','Sick Leave','Casual Leave','Maternity Leave']},
reason:{type:String, default:"Not Specified"},
}
GET request URL
http://localhost:8092/username
This request returns all the leave applications in the system.
PUT request URL
http://localhost:8092/username/leaveId
This request will change the approvalStatus of leave application with _id as leaveId to true. The default approvalStatus is false.
The api endpoints check for the role of the username to allow access.