Question: COMP 3 1 2 3 Full Stack Development I Instructions: You are required to implement the following RESTful API endpoints. Ensure that each endpoint performs
COMP Full Stack Development I
Instructions:
You are required to implement the following RESTful API endpoints. Ensure
that each endpoint performs the correct operation and returns the specified
response code.
Objectives:
Understand RESTful API design principles.
Implement CRUD operations using provided API endpoints.
Test the API endpoints to ensure they return the correct response codes
and data.
As a newly hired Jr Software Engineer my manager assigned me a task to
develop Backend application using NodeJS, Express and MongoDB. He also
wants me to apply my VCS GitHub skills to develop these projects where I
will commit and push all my code to Student#COMPAssignment
repository.
API Endpoints to Implement:
Following is the list of APIs to develop which accept all data as JSON Object
whenever needed:
Sr
#
Method Endpoint Response
Code Description
User Management:
POST apivusersignup
Allow user to
create new
account
POST apivuserlogin
Allow user to
access the
system
Employee Management:
GET apivempemployees
User can get
all employee
list
POST apivempemployees
User can
create new
employee
GET apivempemployeeseid
User can get
employee
details by
employee id
PUT apivempemployeeseid
User can
update
employee
details
DELETE apivempemployeeseidxxx
User can
delete
employee by
employee id
MongoDB Database name: compassigment
Users Collection Schema
id: ObjectId,
"username": String,
"email": String,
"password": String, This should be hashed
"createdat: Date,
"updatedat: Date
User can login using usernameemail and password
Employee Collection Schema:
id: ObjectId,
"firstname": String,
"lastname": String,
"email": String,
"position": String,
"salary": Number,
"dateofjoining": Date,
"department": String,
"createdat: Date,
"updatedat: Date
Sample Input and Output:
API Sample Input Sample Output
POST apivusersignup
"username":
"johndoe",
"email":
"johndoe@exampl
ecom",
"password":
"password
"message":
"User created
successfully.",
"userid:
ceadfc
acbea
POST apivuserlogin
"email":
"johndoe@exampl
ecom",
"password":
"password
"message":
"Login
successful.",
jwttoken:
Optional
implementation
GET apivempemployees
"employeeid:
ceadfc
acbea
"firstname":
"Jane",
"lastname":
"Doe",
"email":
"jane.doe@exampl
ecom",
"position":
"Software
Engineer",
"salary":
"dateofjoining":
T::
Z
"department":
"Engineering"
"employeeid:
ceadfc
acbea
"firstname":
"John",
"lastname":
"Smith",
"email":
"john.smith@exa
mple.com",
"position":
"Product
Manager",
"salary":
"dateofjoining":
T::
Z
"department":
"Product"
POST apivempemployees
"firstname":
"Alice",
"lastname":
"Johnson",
"email":
"alice.johnson@ex
ample.com",
"position":
"Designer",
"salary":
"dateofjoining":
T::
Z
"department":
"Design"
"message":
"Employee
created
successfully.",
"employeeid:
ceadfc
acbea
GET
apivempemployeescea
dfcacbea
"employeeid:
ceadfc
acbea
"firstname":
"Alice",
"lastname":
"Johnson",
"email":
"alice.johnson@ex
ample.com",
"position":
"Designer",
"salary":
"dateofjoining":
T::
Z
"department":
"Design"
PUT
apivempemployeeseid
"position":
"Senior
Designer",
"salary":
"message":
"Employee details
updated
successfully."
DELETE
apivempemployeeseidc
eadfcacbea
"message":
"Employee deleted
successfully."
Testing & Validation
Validation:
o Use libraries like expressvalidator to validate incoming
requests.
Testing with Postman:
o Test all API endpoints and save the Postman collection.
o Capture screenshots of each test.
Sample Error Response:
status: false,
message: Invalid Username and password
Notes:
Make use of express.Routes and modules
Validate the data whenever required
Return error details or success response details whenever required
All data must be sent back and forth in JSON Object format
Optionally apply JWT security concept to secure all your API calls
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
