go-api-example

module
v0.0.0-...-236e835 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2024 License: MIT

README

Go API Example

This is a very small example of a simple API written in Go for a tutorial/walkthrough.

It demonstrates routing http requests, using auth middleware, defining types for requests and responses, some super basic caching for the auth middleware and a few other things.

The structure is very simple and should be easy to follow and build upon.

Endpoints

POST /account/login?username=<username>
POST /account/logout


GET    /account?username=<username>
    Authorization: <authToken>

POST   /account?username=<username>
    Authorization: <authToken>

DELETE /account?username=<username>
    Authorization: <authToken>

Directories

Path Synopsis
cmd
api command
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL