FPT
Education
TRƯỜNG ĐẠI HỌC FPT
Practical Examination
Subject code: SDN301
Duration: 85 minutes
Requirements:
+ Using NodeJS version 16
+ Only using Internet in order to search information and download packages/modules
+ Student put the code of the app on 1 zip file, named the file with the meaningful words: CakeStore.zip (please avoid using the student's name or student ID and do not compress node-modules folder)
+ Build your backend project that manages Cakes Store. The app allows users to implement the REST API (GET, POST, PUT, DELETE) endpoints /cakes and /cakes/:cakeld to interact with the MongoDB database.Moreover, your app can authenticate users basing on token. It allows to anyone to perform GET operations but only an Admin to perform POST, PUT and DELETE operations.
+ Student can write the code based on the specific tasks
1. Create the Cakes schema and Topping schema basing on the below template document (UsingMongoose Population and the price schema is be supported with a new SchemaType called Currency) (3 mark)
{
"type": "donut",
"name": "Cake",
"price": 2.00,
"topping":
[
{"type": "None", "price_extra": 0},
{"type": "Glazed", "price_extra": 2},
{"type": "Sugar", "price_extra": 3},
{"type": "Powdered Sugar", "price_extra": 2},
{"type": "Chocolate with Sprinkles", "price_extra": 3},{"type": "Chocolate", "price_extra": 2},
{"type": "Maple", "price_extra": 2}
},
{
"type": "donut",
"name": "Raised",
"price": 2.35,
"topping":
[
{"type": "None", "price_extra": 0},
{"type": "Glazed", "price_extra": 2},
]