REST API for tracking expenses, like this, but using Spring Data JPA, Lombok etc.
Created using Spring Boot and Spring Data JPA. JSON Web Token (JWT) used to add authentication.
- Clone repo from GitHub
git clone https://github.com/joypatel9/expense-tracker-api.git cd expense-tracker-api - Create a postgres database
- Update the database name, username and password in
src/main/resources/application.properties - Run the spring boot application using
./mvnw spring-boot:run - This runs at port 8080 and hence all endpoints can be accessed starting from http://localhost:8080. For testing, you could use Postman collection ExpenseTracker, using the environment Expense tracker, which are available in src/test/resources/postman
POST /api/users- registers a userPOST /api/users/login- logs in a user, and returns a bearer JWT tokenGET /api/categories- gets all the categories of the current userGET /api/categories/{categoryId}- gets the category of the given categoryIdPOST /api/categories- adds a new category for the current userPUT /api/categories/{categoryId}- updates the category of the given categoryIdGET /api/categories/{categoryId}/transactions- gets all transactions of the given categoryIdPOST /api/categories/{categoryId}/transactions- adds a transaction to the category of given categoryIdGET /api/categories/{categoryId}/transactions/{transactionId}- gets the transaction of given categoryId and transactionIdPUT /api/categories/{categoryId}/transactions/{transactionId}- updates the transaction of given categoryId and transactionIdDEL /api/categories/{categoryId}/transactions/{transactionId}- deletes the transaction of given categoryId and transactionIdDEL /api/categories/{categoryId}- deletes the given category of given categoryId and all its transactions