- 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.sh
after 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 up
from 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/www
contains entry point for application that starts the serverconfig
contains configuration for development & production environment and pm2 configuration for running the app.controllers
contains functions which will be called for handling routes.helper
contains classes used across the applicationmodels
contains mongoose schemas.routes
define the routes for different api endpoints.schemas
contains validation schemas for creating or updating an Order.test
contains unit & Integration Test Cases in unitTests.js and integrationTests.js respectively.util
contains utility classes.app.js
is what builds and configures the express apppackage.json
defines the dependencies need to be installed for running the applicationpackage-lock.json
to lock down the dependencies at specific version so that there is no issue on different machinesstart.sh
is startup script for running the application.eslintrc
file 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.