Node Assignment
The documentation for Node Assignment app which does basic CRUD functions on Requirement resources represented in JSON-LD.
Video Walkthrough
- Watch the video walkthrough of the assignment here.
Features
-
Flexible Schema.
-
Resources represented through JSON-LD.
-
API documentation thtough Swagger UI.
-
Testing through Jest.
-
Dockerized app with the best practices.
Quick Start
(OPTIONAL) Create a .env
file with the following properties:
-
SERVER_URL: Sets the current server url. It could be localhost for dev environment.
-
NODE_ENV: Environment of node app.
-
MONGO_URL: Sets the MongoDB URL, this should also work with DocumentDB.
-
PORT (Optional): Sets the HTTP port number.
Then run the following command:
docker-compose up --build
The api will get exposed at localhost:80
.
Testing workflow
The testing command will the run the test suite and will attempt to do the following:
-
Create 5 new requirements
-
Delete a requirement
-
Retrieve a specific requirement
-
Update a specific requirement to include an additional satisfiedBy property with the value “https://api2.com/testcases/123”. Note: this additional property could also have a different name and a different value. The schema is entirely flexible and the properties can be completely dynamic.
-
Retrieve the updated requirement with the additional property
To run tests, run the following command:
docker-compose -f docker-compose-test.yaml up --build
Project Structure
Name | Description |
---|---|
src/ | Source files |
src/controllers | The controllers of the express app |
src/models | Mongoose models with swagger documentation |
src/routes/ | Express REST API routes with swagger documentation |
src/utils | Reusable utilises and library source code like a logger |
tests/ | Test suites are placed here |
Postman Documentation
Postman Documentation and API Playground is hosted here.