Documentation ¶
Overview ¶
Package apimain :: app.go - main api entrance
Package apimain :: appEnv.go
Package apimain :: appRouters.go
Package apimain :: appServer.go
Package apimain :: info.go
Package apimain :: root.go
Index ¶
- Variables
- func App()
- func AppIndex(ctx cfg.Context, w http.ResponseWriter, r *http.Request) error
- func GetConfig() *cfg.Config
- func GetDbInfo(ctx cfg.Context, w http.ResponseWriter, r *http.Request) error
- func GetDbInfoAll(ctx cfg.Context, w http.ResponseWriter, r *http.Request) error
- func GetInfo(res http.ResponseWriter, req *http.Request)
- func Index(ctx cfg.Context, w http.ResponseWriter, r *http.Request) error
- func Info(ctx cfg.Context, w http.ResponseWriter, r *http.Request) error
- func ListenAndServe(server api.AppServerInterface, ctx *cfg.Context) error
- func NewAppContext() *cfg.Context
- func NewAppEnv() *cfg.Env
- func NewAppServer() *api.AppServer
- func NotDefined(ctx cfg.Context, w http.ResponseWriter, r *http.Request) error
- func NotFound(ctx cfg.Context, w http.ResponseWriter, r *http.Request) error
- func Root()
- type APIInfo
- type Route
- type Routes
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ListenPort is a configurable http port ListenPort = 8181 // RootRoutes configures root routes // optionally read from config or move this to routes.go RootRoutes = Routes{ { "/", "GET", rootHandler, "Index", }, { "/info", "GET", GetInfo, "Info", }, } )
Functions ¶
func GetDbInfoAll ¶
GetDbInfoAll handles /info/db/all path
func ListenAndServe ¶
func ListenAndServe(server api.AppServerInterface, ctx *cfg.Context) error
ListenAndServe starts a server
func NewAppContext ¶
NewAppContext constructs an cfg.Context for the application
func NewAppServer ¶
NewAppServer constructs AppServer with
- a new `*mux.Router`
- negroni middlewares
Any middleware by `negroni.Use()` should implement `negroni.Handler` interface:
``` ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) ```
otherwise, by `negroni.UseHandler()` should implements `http.Handler`.
func NotDefined ¶
NotDefined handles any unimplemented path
Types ¶
type APIInfo ¶
type APIInfo struct { Name string `json:"name,omitempty"` Description string `json:"desc,omitempty"` Copyright string `json:"copyright,omitempty"` Author string `json:"author,omitempty"` APIURL string `json:"api_url,omitempty"` APIInfoURL string `json:"api_info_url,omitempty"` APIVersion string `json:"api_version,omitempty"` Version string `json:"version,omitempty"` }
APIInfo struct
Click to show internal directories.
Click to hide internal directories.