A dynamic api service, with proper route structure and data contracts, covering concepts of ready mock servers, to building your own API server, and including all the proper middleware and testing files.
Author: Yahya Abu Khalil Links and Resources submission PR Github actions
server.js
server module as a centralized base of operations.timestamp.js
a middleware for timestampslogger.js
a middleware to print out each request404.js
error not found middleware500.js
error input/logic middleware
mongo.js
is the primary model/collection that is extended into each of product and category../lib/models
. contain the model and schema for each of product and category../lib/routes
. contain both routes separately.
Clone the repo, and run the following commands to install the required dependencies and dev dependencies.
npm install
to download all that exists inpackage.json
.sudo npm install -g json-server
to test the json-server mock server.npm install mongoose
to run the database properly, and start it beforehand.
npm start
to test the server yourself using postman.npm test
to run the thorough testing functions.
Unit testing with: npm test using supertest to test each route.