webserver

package
v0.0.0-...-d9c1e7a Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const AppName = "B.O.B"

AppName is the name of the application.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIResponse

type APIResponse struct {
	// Ok is true if the request was successful.
	Ok bool `json:"ok"`
	// Code the HTTP code for this response.
	Code int `json:"code"`
	// Message is the message returned by the API.
	Message string `json:"message"`
}

APIResponse is the response returned by the API.

func (*APIResponse) Error

func (ar *APIResponse) Error() string

Error makes it compatible with the `error` interface.

type Config

type Config struct {
	Host string `long:"host" env:"HOST" default:"127.0.0.1" description:"Server host"`
	Port string `long:"port" env:"PORT" default:"8080" description:"Server port"`
}

Config is the configuration for the web server.

type WebServer

type WebServer struct {
	*fiber.App
	// contains filtered or unexported fields
}

WebServer is the main API server.

func New

func New(ctx context.Context, cfg Config, appDB db.DataStore) (*WebServer, error)

New creates a new WebServer.

func (*WebServer) Start

func (s *WebServer) Start() error

Start starts the WebServer.

func (*WebServer) Stop

func (s *WebServer) Stop() error

Stop stops the WebServer.

Jump to

Keyboard shortcuts

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