go-http-server (0.1.0)

Download OpenAPI specification:

License: MIT

Minimal Go HTTP server template demonstrating Postgres + GORM via a /posts CRUD surface. Stays on the standard library net/http router (Go 1.22+ method-prefix routing); no framework lock-in.

meta

Liveness + diagnostic endpoints

Root

Returns 200 with an empty body — useful as a "is anything up" probe.

Responses

Liveness probe

Responses

Response samples

Content type
application/json
{
  • "status": "ok"
}

posts

Demo CRUD entity

List all posts

Returns the public projection (slug/title/body only); id and timestamps are intentionally stripped from list responses.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create a post

Create response is the full record (id, timestamps included) — useful as a receipt so the client can deep-link to the new resource. Reads return the projection only; see GET /posts/{slug}.

Request Body schema: application/json
required
title
required
string
body
required
string

Responses

Request samples

Content type
application/json
{
  • "title": "string",
  • "body": "string"
}

Response samples

Content type
application/json
{
  • "id": "43bca205-ec29-406e-abcf-62bef8806b24",
  • "slug": "my-first-post",
  • "title": "My first post",
  • "body": "string",
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

Get a post by slug

Returns the public projection (slug/title/body only).

path Parameters
slug
required
string

Responses

Response samples

Content type
application/json
{
  • "slug": "my-first-post",
  • "title": "My first post",
  • "body": "string"
}