A progressive Node.js framework for building efficient and scalable server-side applications.
Backend Coding Test Application
As this is a backend test application, there is no front end UI. This application was written to prove competency in NodeJS/Typescript/NestJS.
Victor's Notes
This application consists of a client, and a payment processing microservice. The microservice architecture is command-based using a TCP transport layer.
Technology stack:
- nestjs
- typeorm
- sqlite3
- swagger
- passport authentication (use JWTs)
- eslint/prettier for code lint compliance
- jest/assert for e2e testing
Swagger documentation can be viewed at localhost:3000/swagger
The issues for e2e test are resolved and now run correctly. All assertions are correct.
Authentication Update
Authentication has been moved from the POST body parameter to the header "Authorization" token bearer. An example would be:
headers: {
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6Imxqa2xqYXdlciIsInN1YiI6ImxramtsamtsandlciIsImlhdCI6MTYxMDg5OTk2OCwiZXhwIjoxNjEwOTAwMDI4fQ.lMgXLsjWgUz9yn0giE1NLNY3cQpIY61Dljmybq561zI',
'Content-Type': 'application/json'
},
In order for the consumer to get a valid token, it must first call the endpoint POST localhost:3000/auth/login to receive a valid token. This token expires in 60 seconds.
Description
Nest framework TypeScript starter repository.
Installation
Each service (orders and payments) must be installed and run separately. The payments service must start first as the orders service is connecting to it.
$ npm install
Running the app
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
Test
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
Support
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
Stay in touch
- Author - Kamil Myśliwiec
- Website - https://nestjs.com
- Twitter - @nestframework
License
Nest is MIT licensed.