- Welcome to the documentation for the nestjs-reverse-proxy API built with NestJS. This guide will walk you through the steps to run, build, test, and debug the API.
- This project was developed to assist in the migration of legacy APIs. If you possess an older API and intend to upgrade to a newer version, you can utilize this reverse-proxy to redirect requests from the existing API to the legacy system. This allows you to develop the new code patiently.
- Prerequisites
- Installation
- Running the API
- Docker commands
- Testing
- Linting and Formatting
- Debugging
- Contributing
Before you begin, make sure you have the following tools installed on your system:
-
Clone the repository:
git clone <repository-url> cd nestjs-reverse-proxy
-
Install dependencies:
nvm i 18.17.1 nvm use npm install
To start the API server, run the following command:
npm start
This will start the NestJS server in normal mode. If you want to start the server in development mode with auto-reloading on code changes, use:
npm run start:dev
For production deployment, you can use:
npm run build
npm run start:prod
- To build the API image with docker:
docker build -t nestjs-reverse-proxy .
- To see the existent images:
docker images
- To delete existent images:
docker rmi nestjs-reverse-proxy
- To run your docker container for this image:
docker run -d --name nestjs-reverse-proxy-container -p 3000:3000 nestjs-reverse-proxy
- To see running containers:
docker ps
- To see container's logs:
docker logs nestjs-reverse-proxy-container
- To stop your container:
docker stop nestjs-reverse-proxy-container
- To delete a stopped container:
docker rm nestjs-reverse-proxy-container
To run unit tests, execute:
npm test
To run end-to-end tests, execute:
npm run test:e2e
To generate code coverage reports, run:
npm run test:cov
The coverage reports will be available in the coverage
directory.
To lint and format your code, use the following command:
npm run lint
To automatically fix linting and formatting issues, run:
npm run format
This will run the tests in debug mode, allowing you to attach a debugger.
Before creating a pull request, make sure to:
- Write tests for any new functionality.
- Run the linting and formatting checks using
npm run lint
andnpm run format
.