app

package
v0.2.17 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Config *AppConfig
	Db     *sql.DB
	Router *mux.Router
}

App defines the various components of the app.

func (*App) ConnectToDb added in v0.0.1

func (a *App) ConnectToDb()

ConnectToDb will connect the app to the database specified by a.Config.

func (*App) Get added in v0.0.1

func (a *App) Get(path string, name string, f func(w http.ResponseWriter, r *http.Request))

Get is a wrapper for resources requested with GET.

func (*App) Initialize

func (a *App) Initialize()

Initialize will create the various components of the app needed to run it from a.Config. The app can be configured with a.Config.Load().

func (*App) Ping added in v0.0.1

func (a *App) Ping(w http.ResponseWriter, r *http.Request)

Ping calls the Ping controller.

func (*App) Post added in v0.2.0

func (a *App) Post(path string, name string, f func(w http.ResponseWriter, r *http.Request))

Post is a wrapper for resources requested with POST.

func (*App) Run

func (a *App) Run()

Run will run the app depending on what platform it is configured to run on.

func (*App) Scrumify added in v0.2.0

func (a *App) Scrumify(w http.ResponseWriter, r *http.Request)

Scrumify calls the Scrumify controller.

func (*App) SetMiddleware added in v0.1.2

func (a *App) SetMiddleware()

SetMiddleware will initialize middleware handlers for the router.

func (*App) SetRoutes added in v0.0.1

func (a *App) SetRoutes()

SetRoutes will initialize all the routes of the app.

type AppConfig

type AppConfig struct {
	Database       *DatabaseConfig
	Server         *ServerConfig
	AllowedOrigins string
	Platform       string
}

AppConfig defines the settings of the app that can be configured.

func (*AppConfig) Load

func (ac *AppConfig) Load()

Load will load environmental variables into AppConfig and set default values where applicable.

type DatabaseConfig

type DatabaseConfig struct {
	Host     string
	Port     string
	User     string
	Password string
	Schema   string
	SslMode  string
}

DatabaseConfig defines the parameters needed to connect to a database. Currently, only Postgres databases are supported.

func (*DatabaseConfig) GetInfo

func (dc *DatabaseConfig) GetInfo() string

GetInfo returns the parameters defined in DatabaseConfig.

type ServerConfig

type ServerConfig struct {
	Host string
	Port string
}

ServerConfig defines the parameters needed to serve the app on an IPv4 interface.

func (*ServerConfig) GetAddr

func (sc *ServerConfig) GetAddr() string

GetAddr returns the full IPv4 interface defined in ServerConfig.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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