This API application is a proposal for the implementation of a job that validates and runs Rules for a Business Rules Management System.
The SGRN API is built using the Nest.js framework, which is a powerful and scalable Node.js framework. It uses a relational database (SQLite) to store its data. The API follows RESTful principles and offers an endpoint to execute Business Rules every time a new Order is placed.
The API offers the following endpoints:
GET /:orderId- Runs Business Rules for all Products related to the Order's Id
| Parameter | Type | Description | Example |
|---|---|---|---|
| orderId | number (Required) | ID of the Order that was placed | 1 |
To run the SGRN API locally, follow these steps:
- Install Node.js (Version 18 is recommended)
- Clone this repository to your local machine
- Navigate to the project's directory:
cd sgrn-test - Install package dependencies:
npm install
- Start the API server:
npm run start:dev
The API server will now be running at http://localhost:3000.
You can use tools like Postman or curl to test the API endpoint. But since the only endpoint is a GET endpoint, you can algo test it in you browser. Open any web browser and go to the following address: http://localhost:3000/1
Unit tests and Integration tests are written for all major functions and application flows. SQLite is also being used in the tests, making it possible to validade database operations instead of mocking them.
To run automated tests:
npm run test
Thank you for using SGRN API! Happy coding! 🚀