Simple mechanism for keeping track of radio shows and avoid conflicts.
GET /health
to just see if the application is up and runningGET /show
to get all showsGET /show/{id}
to get a show with this specific integer idPOST /show
to create a showPUT /show/{id}
to update a showDELETE /show/{id}
to delete a show
POST
and PUT
request body for a show should be like:
{
"title": "another radio show",
"weekday": "Sun",
"timeslot": "14:00-16:00",
"description": "best radio show ever baby"
}
- Timeslot should have
hh:mm-hh:mm
format. - Weekday can have one of
Mon
,Tue
,Wed
,Thu
,Fri
,Sat
,Sun
values. - Title cannot have more than
100
characters.
I assume that you have Docker installed. If not, check here.
To start db, run:
make db-start
Please add a .env
file which should have DB_PATH
and PORT
variables. If no PORT
is chosen, 6000
is used by
default.
.env
file should look like
DB_PATH=postgres://127.0.0.1/weeklyprogrammedb?sslmode=disable&user=admin&password=password
PORT=6000
obviously the above vars change according to your configuration.
make migrate
and you'll see the corresponding message that migrations are made.
I assume that you have Go installed. If not, check here. Then run
go mod tidy
go run main.go