A web server that provides a basic HTTP API for querying the dependency tree of an npm package.
To install dependencies and start the server in development mode:
poetry install
poetry run uvicorn app:app --host="127.0.0.1" --port="3000" --log-level="info" --reloadFor convenience a Makefile is provided to run Docker commands
make build
make build-dev
make runserverThe server will now be running on an available port (defaulting to 3000) and will restart on changes to the files in /npm_deps
The server contains two endpoints
- /healthcheck
/package/:packageName/:packageVersion
Here is an example that uses curl and
jq to fetch the dependencies for [email protected]
curl -s http://localhost:3000/package/react/16.13.0 | jq .You can run the tests with this command:
poetry run pytestYou can alternatively run the tests inside the Docker image (built in development mode):
make testThe code is linted using pre-commit, you can run this via:
pre-commit run -a -vor using Docker
make lint-all