This project is a demonstration of Nest.js usage for various purposes.
The app is hosted at Heroku.
Demonstrates using external API resource.
Simply call GET: /postcode/<UK Postcode>
e.g. /postcode/SW1A0AA
and you will receive the postcode district (Westminster
in this case).
This endpoint also provides instant postcode validation (without external API call)
and error handling.
At the moment this project demonstrates:
- Yarn
- Nest.js
- TypeScript
- Jest
- TSlint
- Husky (git hooks)
- Nock (HTTP mocking)
- Modular approach
- Controllers / Services approach
- REST routing and request params
- Calling external APIs
- Error handling
- Unit testing
- E2E testing
- Centralised data mocking
- 100% tests coverage
- Automatic "on-commit" and "on-push" tests running
- 100% lint compliance
This application requires NodeJS 10.16.3 LTS
.
You may use nvm
to install this exact version.
$ yarn install
# development
$ yarn run start
# watch mode
$ yarn run start:dev
# production mode
# Note: If you'd like the application to run on a port other than 3000,
# please specify it in the PORT environment variable.
# Note: Please note, some services like Heroku will run the `build` script automatically.
$ yarn run build
$ yarn run start:prod
# unit tests
$ yarn run test
# e2e tests
$ yarn run test:e2e
# test coverage
$ yarn run test:cov
- Functions descriptions
- External API libraries usage
- Databases
- Sockets usage
- Smaller files (150 lines?) - to investigate if this is a must practice
This project is MIT licensed.