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 install
You might be need to provide your ENV variables in
.env
file (provide your configurations, if you want to.)
$ cp .env.sample .env
For 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-compose
files 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_db
as 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
redis
andmysql
running on your machine (you can verify and validate the configuration in.env
file)
# 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.js
Alternatively, 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-compose
file:
-
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 PID
Note: 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