Categorygithub.com/janlauber/autokueng-api
modulepackage
0.1.1
Repository: https://github.com/janlauber/autokueng-api.git
Documentation: pkg.go.dev

# README

Autoküng API

The autokueng.ch website api

PostgreSQL

Run Test PostgreSQL docker instance:

docker run -it -p 5432:5432 -d -e POSTGRES_HOST_AUTH_METHOD=trust postgres

Env Variables

Set the following env variables:
database

export DB_USERNAME=postgres
export DB_PASSWORD=
export DB_NAME=postgres
export DB_HOST=localhost

jwt secret

# must be the same as in autokueng data api
export JWT_SECRET_KEY=<secret>

user recovery/administration mode if you want to reset the password of a user or register a new one, set the following env variable:

export USER_ADMIN=enabled

recaptcha secret

export CAPTCHA_SECRET=<secret>

smtp

export SMTP_HOST=smtp.gmail.com
export SMTP_Port=465
export [email protected]
export SMTP_Password=thispassword
export [email protected]
export [email protected]
export SMTP_SSL=true

API Reference

The Autokueng API is organized around REST. Our API has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, ans uses standard HTTP response codes, authentication, and verbs.

Authentication

The authentication is done via JWT.

URLMethodDataDescription
/api/v1/loginPOSTusername(string), password(string)Login to the API
/api/v1/authGETusername, IdChecks if user is logged in and sends back username and userId, Is used to check if user is authenticated

User Administration

The user administration is done via the USER_ADMIN env variable.

URLMethodDataDescription
/api/v1/admin/registerPOSTusername(string), password(string)Register new Admin User
/api/v1/admin/reset-passwordPOSTusername(string), password(string)Reset Passwort of given provided username

News

The news route is used to get and set the news article displayed on the front page.

URLMethodDataDescription
/api/v1/newsGETtitle, content, pictureGet news article
/api/v1/newsPOSTtitle, content, pictureSet news article
/api/v1/newsDELETEnothingDelete all news articles

Services

tbd.

Firma

tbd.

Links

tbd.

Kontakt

tbd.

# Packages

autokueng-api - Open-Source Website Copyright (C) 2021 Jan Lauber */.
No description provided by the author
No description provided by the author
No description provided by the author
autokueng-api - Open-Source Website Copyright (C) 2021 Jan Lauber */.