Microservice built with NestJS to manage product-related operations using TCP communication. This microservice uses SQLite as the database for storing product information.
-
📥 Clone the repository:
git clone https://github.com/Nest-Microservices-Samples/products-microservice cd products-microservice -
📦 Install dependencies:
npm install
-
🔧 Set up environment variables: Create a
.envfile based on the provided.env.template:cp .env.template .env
Edit the
.envfile to add the required environment variables. -
🗃️ Run Prisma migrations and generate the client:
npx prisma migrate dev npx prisma generate
-
🛠️ Start the application in development mode:
npm run start:dev
-
🧪 Test the microservice: Use tools like Postman, Insomnia, or
curlto send TCP messages and test the microservice endpoints. Both Postman and Insomnia are powerful tools that allow you to easily create requests, view responses, and debug APIs.
- The
datafolder in the root of the project is intended for adding sample product data to the database for testing purposes. You can place JSON or CSV files with product information in this folder and use scripts or commands to import them into your development database. TablePlus was used to insert these sample data into the SQLite database, test the database functionality, and visually inspect the data.
- For more details about the endpoints and their usage, refer to the
docsfolder or the Postman/Insomnia collection provided. - Learn more about NestJS at nestjs.com.
Built with ❤️ using NestJS.