restapi

package
v0.0.0-...-85cba55 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultSystemConfig

func GetDefaultSystemConfig() *config.SystemConfig

func Init

func Init(conf *config.SystemConfig) error

func IsProduction

func IsProduction() bool

func Run

func Run()

func Shutdown

func Shutdown() error

Types

type App

type App struct {
	Router *mux.Router
	Server *http.Server
	DB     *gorm.DB
	Conf   *config.SystemConfig
}

App has router and db instances

func (*App) Delete

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

Delete wraps the router for DELETE method

func (*App) Get

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

Get wraps the router for GET method

func (*App) Initialize

func (a *App) Initialize(config config.DBConfig) error

Initialize initializes the app with predefined configuration

func (*App) Post

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

Post wraps the router for POST method

func (*App) Put

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

Put wraps the router for PUT method

func (*App) Run

func (a *App) Run(host string)

Run the app on it's router

func (*App) Shutdown

func (a *App) Shutdown() error

Shutdown the app

type RequestHandlerFunction

type RequestHandlerFunction func(db *gorm.DB, w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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