Welcome to the Bike Servicing API repository! This project aims to simplify the management of customers, bikes, and service records for bike servicing centers. Built using modern technologies like Node.js, Express.js, TypeScript, Prisma ORM, and PostgreSQL, this API offers a robust solution for handling CRUD operations with efficient error management.
- Features
- Technologies Used
- Installation
- Usage
- API Endpoints
- Error Handling
- Contributing
- License
- Contact
- Releases
- CRUD Operations: Create, Read, Update, and Delete operations for customers, bikes, and service records.
- Robust Error Handling: Comprehensive error management to ensure smooth API operations.
- RESTful API Design: Follows REST principles for easy integration and use.
- Type Safety: Leverages TypeScript for type safety, enhancing code quality and maintainability.
- Modular Architecture: Organized code structure for easy navigation and scalability.
- Database Management: Utilizes PostgreSQL for reliable data storage and retrieval.
- Prisma ORM: Simplifies database interactions and improves developer productivity.
- Node.js: A JavaScript runtime built on Chrome's V8 engine.
- Express.js: A web application framework for Node.js, designed for building APIs.
- TypeScript: A superset of JavaScript that compiles to plain JavaScript, offering static typing.
- Prisma ORM: An open-source database toolkit that simplifies database workflows.
- PostgreSQL: An advanced, open-source relational database system.
To set up the project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/spolik123-cel/Bike-Servicing-Api-with-postgresql-prismar.git
-
Navigate to the project directory:
cd Bike-Servicing-Api-with-postgresql-prismar
-
Install dependencies:
npm install
-
Set up your PostgreSQL database:
- Create a new database in PostgreSQL.
- Update the
.env
file with your database connection details.
-
Run migrations:
npx prisma migrate dev --name init
-
Start the server:
npm run start
Your API should now be running on http://localhost:3000
.
Once the server is running, you can interact with the API using tools like Postman or cURL. Below are some examples of how to use the API.
To create a new bike service record:
POST /api/services
Content-Type: application/json
{
"customerId": 1,
"bikeId": 2,
"serviceDate": "2023-10-01",
"details": "Full service including brake check."
}
{
"id": 1,
"customerId": 1,
"bikeId": 2,
"serviceDate": "2023-10-01",
"details": "Full service including brake check."
}
Method | Endpoint | Description |
---|---|---|
GET | /api/customers | Get all customers |
POST | /api/customers | Create a new customer |
GET | /api/bikes | Get all bikes |
POST | /api/bikes | Create a new bike |
GET | /api/services | Get all service records |
POST | /api/services | Create a new service record |
The API includes robust error handling. If a request fails, the API will return a meaningful error message along with the appropriate HTTP status code.
{
"error": {
"message": "Customer not found",
"status": 404
}
}
We welcome contributions! If you would like to help improve this project, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/YourFeature
). - Make your changes and commit them (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/YourFeature
). - Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
For questions or feedback, feel free to reach out:
- Author: Your Name
- Email: your.email@example.com
- GitHub: Your GitHub Profile
To download the latest version of the API, visit the Releases section. You can find the latest updates and download the necessary files for execution.
Feel free to check the Releases section for more details about each version and updates.
Thank you for checking out the Bike Servicing API! We hope it serves you well in managing your bike servicing operations efficiently.