Tokenizer microservice with hexagonal architecture, developed using Nest and documented with OpenAPI
- Clone the project
- Navigate to the project folder, for example
cd tokenizer
- Create de redis resource:
$ kubectl apply -f etc/kubernetes/redis-deployment.yaml
$ kubectl apply -f etc/kubernetes/redis-service.yaml
- Deploy and expose the tokenizer app:
$ kubectl apply -f etc/kubernetes/tokenizer-deployment.yaml
$ kubectl apply -f etc/kubernetes/tokenizer-service.yaml
- Redirect tokenizer app traffic to localhost:
$ kubectl port-forward svc/app-tokenizer-service 3000:8080
- Test the app. The
apikey
is required in the header, for example:x-api-key: pk_test_LsRBKejzCOEEWOsw
. You can import the Postman collection located atetc/postman
for this purpose.
- Clone the project
- Install dependencies
$ npm install
- Run docker file to get Redis up locally
$ docker-compose up -d
- Clone the file
.env.example
and rename it to.env
, edit the new file if necessary - Build the app
$ npm run build
- Run the app
$ node dist/main
- Test the app. The
apikey
is required in the header, for example:x-api-key: pk_test_LsRBKejzCOEEWOsw
. You can import the Postman collection located atetc/postman
for this purpose.
This microservice has unit tests, integration tests and e2e tests
# run all tests
$ npm run test
# unit tests
$ npm run test:unit
# integration tests
$ npm run test:integration
# e2e tests
$ npm run test:e2e
This microservice has a coverage greater than 95%
# test coverage
$ npm run test:cov
All endpoints documented using OpenAPI
Go to http://{aplication_url}/docs
for example http://localhost:3000/docs