Categorygithub.com/vanvoljg/go-apiserver
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 on
  • DATABASE_URL - PostgreSQL connection url

Running the app

  • ./go-apiserver will start the server
  • Endpoint: /categories
    • GET: Returns a JSON object with a list of categories
    • POST: Add a category to the database. Send a request body, encoded as application/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 id
    • DELETE: 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

# Structs

Category schema.
Product schema.
Route struct.

# Type aliases

Routes array.