The inspirational quotes for the Kontr developed in Go.
Here are the installation instactions how to install and build from scratch
$ go get github.com/pestanko/kinspiration
Here are the instructions how to run the project
Environment variables that can be configured
QUOTES_TOKEN=<admin_token>
QUOTES_FILE=<path_to_file>
QUOTES_HOST=<host:port>
-
QUOTES_TOKEN
- If it is set, thePOST
andDELETE
methods are secured and theAuthorization
header is required. Authorization header should be in the format:Authorization: Bearer <QUOTES_TOKEN>
-
QUOTES_FILE
- Location where the file with quotes are stored. If not provided, the "default path" is used. Default path is thequotes.json
-
QUOTES_HOST
- Sets host and port for the router, default is the:3000
Run the server using the command
$ kinspiration
There is a directory - examples
that contains quotes.json
that you can be used.
Example format:
[
{
"id": "b4a1936e-37af-4860-8c49-f39ab1e6c907",
"quote": "Life isn’t about getting and having, it’s about giving and being.",
"author": "Kevin Kruse"
},
{
"id": "acca7060-1f1d-4d0f-b9e3-40783255d4b6",
"quote": "Whatever the mind of man can conceive and believe, it can achieve.",
"author": "Napoleon Hill"
},
...
]
Where:
id
is autogenerated UUID4 idquote
is the quote itselfauthor
is the author of the quote
Here are described the endpoints
Format is the [HTTP_METHOD] /path
- Description
[GET] /quotes
- List of all quotes (No Authorization required)[GET] /quote/{id}
- Get one quote by it'sid
(No Authorization required)[GET] /random
- Get one random quote (No Authorization required)[POST] /quotes
- Create a quote (Authorization required), required params arequote
andauthor
[DELETE] /quote/{id}
- Delete quote by id
To add new quote you need to send a JSON
to the /quotes
endpoint using the POST
method
Request body:
{
"quote": "I'd like a dinner reservation for twelve.",
"author": "John Wick"
}