command
module
Version:
v0.0.0-...-650db0a
Opens a new window with list of versions in this module.
Published: Feb 25, 2021
License: BSD-3-Clause
Opens a new window with license information.
Imports: 17
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Go API example with JWT auth
Boiler plate code for APIs protected by username/login and javascript web token with a 10 minute expiry time.

Companion app, which provides the UI for this API server
Features
- New users get saved to Postgres.
- Set Env Var
NEEDS_AUTH=yes on Heroku for auth
- If you want auth also set
TOKEN_PASSWORD=yourlongsecretkeyhere so you can generate tokens
Endpoints:
- api/user/login
- api/user/new
- api/quote
The login and new take a JSON payload of {"email": "valar@morghulis.com", "password": "valardohaeris"}
While quote requires an Authorisation Header with the Bearer token issued by user creation or log in (if NEEDS_AUTH == yes)
This repo is heavily based on Adigun Olalekan's excellent post here:
https://medium.com/@adigunhammedolalekan/build-and-deploy-a-secure-rest-api-with-go-postgresql-jwt-and-gorm-6fadf3da505b
again...
Documentation
¶
There is no documentation for this package.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.