Runnerz is a simple Spring Boot application for tracking running activities. Users can log runs, view run details, and manage their running records easily.
- Log Runs: Add new running entries with details like title, start and end times, distance, and location.
- View Runs: Retrieve a list of all runs or search by specific criteria.
- Manage Runs: Update or delete existing runs.
- Java 17 or higher
- Spring Boot framework
-
Clone the repository:
git clone https://github.com/av-dotcom/runnerz.git cd runnerz -
Set up the database:
Ensure you have a running instance of a database supported by Spring JDBC. Update your database credentials in the
application.propertiesfile. -
Run the application:
Use Maven to build and run the application:
mvn clean install mvn spring-boot:run
The application will start on
http://localhost:8080.
- Add a Run: Use the
/runsendpoint to create a new run. - View Runs: Access
/runsto view all runs or/runs/{id}to view a specific run. - Update/Delete a Run: Modify or remove run entries using the
/runs/{id}endpoint.
RunRepository: Handles database operations for run records, using Spring JDBC for queries and updates.
public List<Run> findAll() {
return jdbcClient.sql("select * from run").query(Run.class).list();
}
public void create(Run run) {
jdbcClient.sql("INSERT INTO Run(id, title, started_on, completed_on, miles, location) values(?,?,?,?,?,?)")
.params(List.of(run.id(), run.title(), run.startedOn(), run.completedOn(), run.miles(), run.location().toString()))
.update();
}