NOTE: The API is deployed at https://fd-rest-api.onrender.com/
- Prisma ORM, PostgreSQL for database
- Dynamic pricing module for calculating delivery costs.
- REST API endpoints for dynamic pricing calculations.
- Input validation using zod.
- Used dummy data for testing using the seed.ts (for seeding)
- Node.js (version 20.x or later recommended)
- PostgreSQL (version 16.x or later recommended)
- npm (included with Node.js)
-
Clone the repository:
git clone https://github.com/Utkarsh1504/fd-rest-api cd fd-rest-api -
Install dependencies:
npm install
-
Set up the database:
- Create a PostgreSQL database. (render or neon)
- Create
.envfile - Add the PostgreSQL URL in the
.envfile asDATABASE_URL=
-
Run the server:
npm run dev
The API endpoints for calculating delivery costs are documented below:
- POST /api/calculate-price
- Body:
{ "zone": "central", "organization_id": "5", "total_distance": 12, "item_type": "perishable" } - Response:
{ "total_price": 20.5 }