modulepackage
1.0.0-alpha
Repository: https://github.com/vanvoljg/go-apiserver.git
Documentation: pkg.go.dev
# README
Go API Server
Author: Jesse Van Volkinburg
Setup
.env
requirements
PORT
- Port Number for the API server to run onDATABASE_URL
- PostgreSQL connection url
Running the app
./go-apiserver
will start the server- Endpoint:
/categories
GET
: Returns a JSON object with a list of categoriesPOST
: Add a category to the database. Send a request body, encoded asapplication/json
, of the form:
{
name: "name",
display_name: "display name",
description: "description"
}
Return value will be the added category, with id, as a JSON object.
- Endpoint:
/categories/:id
GET
: Returns a JSON object with the category requested by the given idDELETE
: Deletes a category specified by the given id from the database, if it exists. Returns a JSON object with the deleted category in it.
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
GetAllCategories sends JSON of categories.
No description provided by the author
Logger makes a nice-looking log format Method URI Name Time.
NewRouter returns a new router.
No description provided by the author
# Type aliases
Routes array.