SDN302_-_SU_2025_-_PE_3967.webp
Erza_girl

SDN302_-_SU_2025_-_PE_3967.webp

☑Kizspy.me
pw{type: String, required: true},
},{timestamps: true, });
Task 01 (1.0 mark). Using the Express generator for developing the REST API server, create the related apartments, and
migrate them to a database named SDN302_PE_SU25_StudentCodeDB (MongoDB).
Task 02 (5.0 marks) Create a REST API server to the apartment collection, you must use JSON Web Token (JWT) for
authenticating API. The secret key of JWT must be your StudentCode!! (e.g., se171234!!) and store in the .env file.
The route path will match requests to:
-
/auth/login for generating the JWT.
/api/apartments and /api/apartments/:id for all methods related to apartments.
Implement CRUD actions with apartment collection.
For the DELETE operation, ensure an apartment cannot be deleted if any residents are associated with it (i.e., if
there are documents in the resident collection referencing the apartment's _id). Return an appropriate error
message (e.g., "Cannot delete apartment because it has associated residents") if deletion is attempted in such
cases.
Task 03 (4.0 marks). Client application for resident management
Student must choose one of template engines (EJS, HANDLEBARS, or PUG) with Express for building the views.
1. Authentication function
At the login view, the route path will match requests to: auth/signin. Users must enter their account name (us)
and password (pw) correctly (encrypted with bcrypt and stored in the 'accounts' collection). All CRUD actions
require authentication. Display error messages for failed logins. Store account data in the 'accounts' collection from
'account.json'. Redirect to the residents view after a successful login.
Zoom
+100%
Close
Chưa có bình luận nào.

Thông tin

Category
SDN302
Thêm bởi
Erza_girl
Ngày thêm
Lượt xem
1,742
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom