api

package
v0.0.0-...-927f0f1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 License: LGPL-3.0 Imports: 17 Imported by: 0

README

HTTP API

The server runs on port 4000

Responses should always be in json format They should always contain a field that tells if the operation was succesful.

Example of an error message:
{
    "Success": false,
    "Message": "Sample error message"
}

Routes:

Get all subjects:

GET /subjects

Get specific subject:

GET /subject/:id

Get a specific course:

GET /course/:id

Get all courses:

GET /courses

Get groups in a specific season:

GET /groups/:seasonID

Get an users schedule:

POST /schedule

Websocket connection for realtime updates from server:

Websocket connection to: /ws

Login and authentication:

POST /auth/login

POST /auth/adduser

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSessNotFound = errors.New("Session not found")

ErrSessNotFound is thrown when session is not found while looking for session

Functions

func StartServer

func StartServer()

StartServer starts the http server which will serve the api

Types

type Session

type Session struct {
	SessionID string
	UserID    string
	Expires   int64
}

Session represents an user that has logged in. To complete any actions that require authentication, you need an valid session id. sessions are stored in the database and expire in 30 minutes after inactivity if not defined otherwise.

Jump to

Keyboard shortcuts

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