Skip to content

Latest commit

 

History

History
42 lines (38 loc) · 2.25 KB

README.md

File metadata and controls

42 lines (38 loc) · 2.25 KB

Simple Spring Boot TO-DO

A spring boot application that uses MVC and the Hibernate ORM to conect to a Postgres database

Getting Started

  1. Start Postgres database using the command:
    docker-compose up
    [Development Only]: Once the database server has been started it can be connected to using the command:
    psql -h localhost -p 5440 -U admin
    Once prompted for the password enter: admin100%
  2. Once signed into the postgres client cli tool, create the todo database using the command
    CREATE DATABASE todo;
    The database can also be created using the single command below:
    PGPASSWORD=admin100% psql -U admin -h localhost -p 5440 -c 'create database todo;'
  3. Exit the postgres client and start the Spring Boot server using the command:
    mvn spring-boot:run

Testing

Test this project using the command:
mvn test

Sample Curl Requests

Create Account
curl -d '{"email":"example@gmail.com", "password":"password"}' -H "Content-Type: application/json" -X POST http://localhost:8080/api/v1/auth/register
Sign In
curl -d '{"email":"example@gmail.com", "password":"password"}' -H "Content-Type: application/json" -X POST http://localhost:8080/api/v1/auth/login
Create TODO List Item
curl -d '{"entry": "my test todo item"}' -H "Authorization: Bearer [JWT TOKEN]" -H "Content-Type: application/json" -X POST 'http://localhost:8080/api/v1/list'
Get TODO List Items
curl -H "Authorization: Bearer [JWT TOKEN]" -H "Content-Type: application/json" -X GET 'http://localhost:8080/api/v1/list?filter=&offset=0&limit=40'
Update TODO List Item
curl -d '{"id": 1, "entry": "hello world 2", "checked": true}' -H "Authorization: Bearer [JWT TOKEN]" -H "Content-Type: application/json" -X PUT 'http://localhost:8080/api/v1/list'
Delete TODO List Item
curl -d '{"id": 1}' -H "Authorization: Bearer [JWT TOKEN]" -H "Content-Type: application/json" -X DELETE 'http://localhost:8080/api/v1/list'