API responsible to provide data for the Overchain APP
We have additional documentation at the docs folder, explaining more about the endpoints. We are also covered by the OpenAPI specification, and you can take a look at these links:
You can launch the docker instance:
docker-compose up --build -d -V overchain-web-api
Our Docker image is based on the official node image.
The API is served at localhost:8080
by default.
In dev environment we have auto-reload enabled, so you can modify files and see the changes in real-time
You can also run our service outside the docker, if you want to test the application behavior in your own environment
You will need the following things properly installed on your computer.
- Make sure you have
node
installed and added to yourPATH
. - Install and sync all dependencies with
npm install
- Get a coffee, it can take a few minutes depending on your internet connection. And don't despair if don't get all the environment working on the first try.
This API uses connections with Firestore, Firebase Admin and have a Google Cloud Storage client, so you need to create a .env file including a proper configuration for the connections. Here you can learn more about how to create and configure the .env file.
# development
❯ npm run start
# watch mode
❯ npm run start:dev
# debug mode
❯ npm run start:debug
# production mode
❯ npm run start:prod
And then test your app at http://localhost:5000/.
package.json and package-lock.json will be automatically updated during
❯ npm install <dependency>
- Our .ts code is formatted with Prettier and ESlint. Configuration for both are stored inside .prettierrc.js and .eslintrc.js.
We use Husky, powered by Git Hooks.
- All configuration is stored inside .husky ;
- Husky will run locally before each commit;
- Install and prepare the environment to use the hooks: https://typicode.github.io/husky/#/
# this will initialize the git hooks
❯ npm run prepare
# maybe you'll have to install husky globally, if this happen:
❯ npm install husky -g
The expected behavior here is that the pre-commit is performed and only goes through all the hooks with a 'passed' status. But If the modifications that you did broke some pattern, it will fail on the related hook.
Tests are located at the tests directory and inside application folders, with the pattern '*.spec.ts'
.
# run unit tests
❯ npm run test
# run unit tests
❯ npm run test
# run e2e tests
❯ npm run test:e2e
# run test coverage
❯ npm run test:cov