This is the backend API for the LogMeUp application, built with Go and PostgreSQL.
- Go 1.21 or later
- PostgreSQL 14 or later
- golang-migrate CLI tool
- Create a PostgreSQL database:
CREATE DATABASE logmeup;- Copy the
.env.examplefile to.envand update the values:
cp .env.example .env- Run database migrations:
migrate -path migrations -database "postgresql://postgres:postgres@localhost:5432/logmeup?sslmode=disable" up- Install dependencies:
go mod tidy- Run the application:
go run cmd/api/main.goPOST /api/notes- Create a new noteGET /api/notes/:id- Get a note by IDGET /api/notes?date=YYYY-MM-DD- Get notes by datePUT /api/notes/:id- Update a noteDELETE /api/notes/:id- Delete a note
POST /api/actions- Create a new actionGET /api/actions/:id- Get an action by IDGET /api/actions/note/:note_id- Get actions by note IDPUT /api/actions/:id- Update an actionDELETE /api/actions/:id- Delete an action
To run the application in development mode with hot reload:
go install github.com/cosmtrek/air@latest
airRun the tests:
go test ./...