Skip to content

peterahlstrom/log-book

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

log-book

Prerequisites

Go version > 1.23.5

Development

Tests

Run tests:

$ go test ./...

Deployment

Edit config.json

config.json example

{
  "validApiKeys": {
    "abc123": "dev",
    "def456": "prod"
  }
}

Deploy server and database

$ docker compose up

Endpoints

POST /book

Adds a new book to the database.

  • The request must contain a valid JSON payload.

Example Request Body:

{
  "title": "Confederacy of Dunces",
  "author": "John Kennedy Toole",
  "year": 1980,
  "publisher": "Louisiana State University",
  "readtime": "2023-11-24",
  "rating": 4,
  "comments": "",
  "language": "English",
  "genre": "Satire",
  "isbn": "0-8071-0657-7"
}

GET /book

Returns a list of all books.

Example Response:

[
  {
    "id": "1",
    "title": "Foo Bar",
    "author": "Foo"
  },
  {
    "id": "2",
    "title": "Confederacy of Dunces",
    "author": "John Kennedy Toole"
  }
]

GET /book/:id

Returns a book by its unique identifier.

  • :id is the unique book ID.

Example Response:

{
  "id": "1",
  "title": "Foo Bar",
  "author": "Foo",
  "year": 2021,
  "publisher": "Example Publisher",
  "readtime": "2023-12-10",
  "rating": 5,
  "comments": "Great read!",
  "language": "English",
  "genre": "Fiction",
  "isbn": "123-456-789"
}

DELETE /book/:id

Deletes a book from the database.

:id is the unique book ID.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published