Problem Statement 2 - Food-App
Problem Statement 2 - Food-App
It is known fact that in today’s work-from-home world, people prefer ordering food that
can be delivered at the comfort of their home. So most of the times people end up
ordering food from restaurants that have delivery services. The objective of this problem
statement is to come up with a solution for people to order food online and get prompt
delivery.
You need to solve the given problem by developing a web application, that should
facilitate users to order food online from different restaurants using the web-app to cater
their needs.
Scope of work
You have been asked to build the backend system for the following:
• Registration
• Login and
• Display the list of Food items
Backend :
Below are the end points to be built
Method End point Description + Payload
POST /api/register To register the user with basic
details like
Input:
{
id: Number,
username: String,
email: String,
password: String
address: {
houseno: Number,
street: String,
city: String,
state: String,
zip: number
}
}
Input:
{
username: String,
password: String
}
Return:
{
message: User logged in successful
}
Return Code: 200
When user details are wrong Return
Code : 403 (Forbidden)
GET /api/users To get all the users who are
registered to the system, the end
point should return an array,
[
{
id: Number,
username: String,
email: String,
password: String
address: {
houseno: Number,
street: String,
city: String,
state: String,
zip: number
}
},
{
id: Number,
username: String,
email: String,
password: String
address: {
houseno: Number,
street: String,
city: String,
state: String,
zip: number
}
}
]
Return code: 200
GET /api/users/:userID To return user by specifying id
When valid
{
id: Number,
username: String,
email: String,
password: String
address: {
houseno:Number,
street:String,
city:String,
state:String,
zip:number
}
}
Return Code: 200
When Id not found:
{
Message:”Sorry user With <ID> not
found”
}
PUT /api/users Should update the user specified in
the payload which shall match the
ID and updated the existing user
with the new details.
When valid
{
id: Number,
username: String,
email: String,
password: String
address: {
houseno:Number,
street:String,
city:String,
state:String,
zip:number
}
}
Return Code: 200
When Id not found:
{
Message:”Sorry user With <ID> not
found”
}
DELETE /api/users/:userID Should delete the user which is
specified in the :userID
When Valid :
{
Message:”User Deleted
Successfully”
}
Return Code: 200
When Id not found:
{
Message:”Sorry user With <ID> not
found”
}
POST /api/food To add a new food to the system.
{
foodId:number,
foodName:String,
foodCost:Number,
foodType: Indian/Chinese/Mexican
}
Return Code : 201, and the id should
be generated by the system
Return Payload
{
Id:Number
foodId:number,
foodName:String,
foodCost:Number,
foodType: Indian/Chinese/Mexican
}