A web server that provides a HTTP API to query the dependency list for an npm package with a given version.
To install dependencies and start the server in development mode:
npm install
npm start
The server will by default start on port 3000 and will restart on changes to the files in ./src/
.
The server can be started on a custom port
npm start -- --port 3001
The server contains two endpoints - /healthcheck
and /package/:packageName/:packageVersion
.
You can fetch the dependencies for [email protected]
via:
curl http://localhost:3000/package/react/16.13.0 | jq .
You can run the test suite with this command:
npm run test
By default this only runs unit and integration tests, but does not run the end-to-end tests.
The project contains unit, integration and end-to-end tests, located in /tests
. You can execute them separately:
npm run test:unit
npm run test:integration
npm run test:e2e
The project uses typescript for type checking. You can run typescript via:
npm run build
Typescript will also transpile the code to javascript. You can find the transpiled code in ./dist/
.
The code is linted using eslint. You can run the linter via:
npm run lint
The code is formatted using prettier. You can format the code via:
npm run format
You can build a docker image and run a containerized version of the application:
docker build -t dependency_server . && docker run -p 3000:3000 dependency_server