UoM-Open Learning Platform එකේ Server-side web programming එක ඉවර කරපු කවුරු හරි ඉන්නවද ?

Buzzinga

Member
May 18, 2022
2
0
1
UoM-Open Learning Platform එකේ Server-side web programming එක ඉවර කරපු කවුරු හරි ඉන්නවද ?

unnamed%20%285%29.png
 

Buzzinga

Member
May 18, 2022
2
0
1
Content eka mnwd kyl tynwd
ow bro

Dear Students,

Congratulations on completing all the lecture topics and the guided project of the course. Here you have an interesting activity based on a use case as an assessment.

Use case

A retail shop needs to maintain a product stock and purchase orders through a web

application. The customers can submit their orders via the web application. As a backend developer, you

need to develop an API to register a customer in the system.

Below, please find a sample request and response JSON data for registering a customer.

Sample Request JSON for registering a customer

1669298329998.png

Sample Response JSON for a successful registration

1669298358811.png

customerId: This should be the generated id from the database

1. Update the database.js file with the required data definition (CREATE TABLE statement) to create the


data table to store the data of customers
Table name: customer
2. Implement a new API in the server.js file to register a customer and add the data record to the table.

The method of the API should be POST
Include the proper error handling
HTTP error codes
Success: 201 Created
An Error: 400 Bad Request
Reference for HTTP error codes - Link
3. Implement validation to validate POST data to the same API as below

Email address validation
Credit card number validation (12 digits)
Resources:
To test the expected outcome, you can pull the codebase from the below repository and edit the relevant files(database.js and server.js)

Git repository: https://github.com/opencourse5tutor/products-api

Answer Submission Instructions

Students should submit the following files.
  1. A screenshot of a successful customer registration using the Postman tool.
  2. database.js file
  3. server.js file
The customer name should be assigned with the student's name in the customer information. (*Note: Please DO NOT put other personal information such as your email, date of birth, and credit card information as customer data.)