The project is created using Nest framework TypeScript starter repository.
You may check INFO.md file for more info about the implementation and approach and more.
For TCP Client module you may check ./client/README.md file.
$ npm installYou might be need to provide your ENV variables in
.envfile (provide your configurations, if you want to.)
$ cp .env.sample .envFor this project to run, you need following services / tools to be installed on your system, up and running.
- Node.js & NPM
- Redis
- MySQL
I have also added docker
docker-composefiles for you so you can quickly run them without installing on your actual machine. Checkout /docker for it.
Important: Please make sure once the mysql is running.. you need to create a database called
test_db(please verify the name in your configuration or usetest_dbas the default one). This is required only for first time.
This is all you need. :)
Once everything is installed, up and running, you can proceed to the next steps.
Note: To run the project locally, make sure the
redisandmysqlrunning on your machine (you can verify and validate the configuration in.envfile)
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod$ npm run start:tcp
## Or, maybe run using `node`:
$ node tcp-server.jsAlternatively, you can also run the project by building docker image and using
docker-compose, check the next steps.
NOTE: The TCP server runs inside the this main application container, where we have REST HTTP API server + TCP server runs together via
docker-composefile:
-
docker-compose up -
docker-compose down -
docker-compose build -
restart via docker-compose:
docker-compose down && docker-compose build && docker-compose up -
Build docker image:
docker build -f Dockerfile .
- Error: listen EADDRINUSE: address already in use ::1:3400 ?
$ lsof -i :3400 # check PID
$ kill PIDNote: Currently, only the setup for automation tests is already configured.
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov