()
| 23 | ) |
| 24 | |
| 25 | func main() { |
| 26 | app := iris.New() |
| 27 | |
| 28 | db := mustConnectDB() |
| 29 | mustCreateExtensions(context.Background(), db) |
| 30 | mustCreateTables(context.Background(), db) |
| 31 | |
| 32 | app.Post("/", insert(db)) |
| 33 | app.Get("/", list(db)) |
| 34 | app.Get("/{event_id:uuid}", getByID(db)) |
| 35 | |
| 36 | /* |
| 37 | curl --location --request POST 'http://localhost:8080' \ |
| 38 | --header 'Content-Type: application/json' \ |
| 39 | --data-raw '{ |
| 40 | "name": "second_test_event", |
| 41 | "data": { |
| 42 | "key": "value", |
| 43 | "year": 2022 |
| 44 | } |
| 45 | }' |
| 46 | |
| 47 | curl --location --request GET 'http://localhost:8080' |
| 48 | |
| 49 | curl --location --request GET 'http://localhost:8080/4fc0363f-1d1f-4a43-8608-5ed266485645' |
| 50 | */ |
| 51 | app.Listen(":8080") |
| 52 | } |
| 53 | |
| 54 | func mustConnectDB() *sql.DB { |
| 55 | connString := fmt.Sprintf("host=%s port=%d user=%s password=%s dbname=%s sslmode=disable", |
nothing calls this directly
no test coverage detected
searching dependent graphs…