- Docker as the container service to isolate the environment.
- Node.js (Long-Term-Support Version) as the run-time environment to run JavaScript.
- Express.js as the server framework / controller layer
- MongoDB as the database layer
- Mongoose as the "ODM" / model layer
- Clone the repo
- Set Google Distance API key in config/production.json file line no.2
- Run
./start.shafter installing them start three containers:- the MongoDB database container
- the Node.js app container
- After starting container, test cases will run automatically
- You can run
docker-compose upfrom terminal - Server is accessible at
http://localhost:8080 - Run manual test case suite
-
For Running Unit Test Cases: sudo docker exec logistic_app_1 npm test test/unitTests
-
For Running Integration Test Cases: sudo docker exec logistic_app_1 npm test test/integrationTests
-
You should be able to run npm install followed by npm test test to run everything (assuming you have the LTS version of Node installed on your machine).
./
bin/wwwcontains entry point for application that starts the serverconfigcontains configuration for development & production environment and pm2 configuration for running the app.controllerscontains functions which will be called for handling routes.helpercontains classes used across the applicationmodelscontains mongoose schemas.routesdefine the routes for different api endpoints.schemascontains validation schemas for creating or updating an Order.testcontains unit & Integration Test Cases in unitTests.js and integrationTests.js respectively.utilcontains utility classes.app.jsis what builds and configures the express apppackage.jsondefines the dependencies need to be installed for running the applicationpackage-lock.jsonto lock down the dependencies at specific version so that there is no issue on different machinesstart.shis startup script for running the application.eslintrcfile for code lint.
Response:
[ { "id" : "5bee80b9bde99e30fbaa7b67", "distance" : "9999", "status" : "TAKEN", }, { "id" : "5bee80b9bde99e30fbaa7b69", "distance" : "200", "status" : "UNASSIGNED", } ]
Request:
{
"origin" :["28.704060", "77.102493"],
"destination" :["28.535517", "77.391029"]
}
Response:
{
"id": "5bee80b9bde99e30fbaa7b6b",
"distance": 9160,
"status": "UNASSIGNED"
}
Request:
{
"status" : "TAKEN"
}
Response:
{
"status": "SUCCESS"
}
- Add google distance Api key in configuration file located in config/production.json
Swagger documentation can be found at /swagger.json
Linting configuration available at /.eslintrc.