Question
Your web service needs to be implemented using the node.js framework. Your web server should use SQLite to connect to a (given) product database, and
Your web service needs to be implemented using the node.js framework. Your web server should use SQLite to connect to a (given) product database, and then allow this database to be manipulated by handling incoming HTTP requests appropriately.
Your web service needs to provide web clients with the following functionality:
- to retrieve the full data set (all rows currently stored in your local product inventory database);
In addition, it should provide the so-called minimal CRUD (Create, Retrieve, Update and Delete) interface on single rows. That is, it should be possible:
- to add data for a new product item (Create),
- to list the data of a specific item (Retrieve),
- to change data of a specific item (Update), and
- to remove data of a specific item (Delete);
To realize this functionality, your web service has to allow web developers to manipulate the data in the product inventory over a RESTful HTTP 1.1 API. To be truly RESTful, it needs to meet the following requirements:
- The API uses the most appropriate HTTP 1.1 method for each function it provides.
- Every HTTP GET method should be guaranteed safe;
- except for POST, all other HTTP methods should be idempotent;
- in all HTTP responses, the response body is served in the format that is currently most popular under web developers: JSON. Your service should also accept JSON data as input (i.e. to create or update an item), this data should be sent in the request body (and not in the URL query parameters);
- all responses deploy the most appropriate HTTP header(s) (including one indicating the appropriate MIME type of the data returned - this should be taken care of by express for you, but check in the response headers this is indeed the case);
- all responses deploy the most appropriate HTTP response codes, not only on successful, but also on failed requests.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started