Skip to content

abukhalil-LTUC-ASAC/api-server

Repository files navigation

LAB 06 - API Server

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.

Project Details

Author: Yahya Abu Khalil Links and Resources submission PR Github actions

Modules and Middlewares

  • server.js server module as a centralized base of operations.
  • timestamp.js a middleware for timestamps
  • logger.js a middleware to print out each request
  • 404.js error not found middleware
  • 500.js error input/logic middleware

Database and Routes

  • 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.

Setup

Clone the repo, and run the following commands to install the required dependencies and dev dependencies.

  • npm install to download all that exists in package.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.

Running the app

  • 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.

Unified Modeling Language (UML)

UML image

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published