The Car data model is based on https://schema.org/Car. A Car
has an internal identifier (id
) which is a UUID URN automatically generated by the API implementation. In addition each Car
resource has a unique vehicleIdentificationNumber
that also plays the role of ObjectId
in MongoDB, so that its uniqueness is preserved.
- The
vehicleIdentificationNumber
must be supplied, together withbrand
andmodel
when creating a newCar
resource. - When updating an existing
Car
resource thevehicleIdentificationNumber
must not be present. Car
resources are represented using JSON-LD, thus the additional@context
member is present.
- docker & docker-compose
- Node 16
- npm 8
There is an intermediate step to create a Docker network (named data-center
) on which the containers will live.
npm run docker-network
npm run start-docker
Note: The command above will build the image and compile the source within the container (it does not mean this is the best practice, though, it has been put in place to avoid possible mismatches with the tester's local node version).
Afterwards the API service will be listening to http://localhost:5000
and also a MongoDB container will be running. You can test the API Service is running properly by
curl --location --request GET 'http://localhost:5000/cars'
npm run stop-docker
- Postman collection
- Open API Specification. Such specification is generated by merging the JSON Schema used by the implementation and the Open API definition.
- It would be good to automatically generate the mongoose Schema from the JSON Schema to avoid repetition and improve maintainability.
- It would be good to incorporate functional tests to test all the API functionality, moving towards CI.
- It would be good to rollup all the contents in a single file and find a way to minimize the container size (probably by compiling locally instead of on the container)