This project is a simple RESTful API for managing couriers and tracking their locations. The API provides basic CRUD operations for the Courier entity, as well as the ability to track and retrieve courier locations over time.
- Java 17
- Spring Boot 3.3.2
- Spring Data JPA
- PostgreSQL
- Maven
- Java 17 or later installed
- PostgreSQL database running
- Maven installed
-
Clone the repository:
git clone github.com/erensunar/courier-tracking.git cd courier-tracking -
Configure the database in the
src/main/resources/application.propertiesfile:spring.datasource.url=jdbc:postgresql://localhost:5432/your-database-name spring.datasource.username=your-username spring.datasource.password=your-password spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true
-
Build and run the application:
mvn clean install mvn spring-boot:run
- GET
/api/couriers: Retrieve all couriers - GET
/api/couriers/{id}: Retrieve a specific courier by ID - POST
/api/couriers: Create a new courier - PUT
/api/couriers/{id}: Update an existing courier by ID - DELETE
/api/couriers/{id}: Delete a courier by ID
- POST
/api/locations: Create a new location entry for a courier - GET
/api/locations/courier/{courierId}: Retrieve all locations for a specific courier, ordered by timestamp.
You can use curl, Postman, or any HTTP client to interact with the API.
curl -X POST http://localhost:8080/api/couriers -H "Content-Type: application/json" -d '{"name": "John Doe"}'