Documentation ¶
Overview ¶
Package skr doc
A simple and lightweight web framework, pure native and no third dependencies.
::quickstart::
package main
import (
"github.com/go-the-way/skr" "github.com/go-the-way/skr/context"
)
func main() { skr.DefaultApp.Get("/", func(ctx *context.Context) { ctx.Text("Hello world") }).Run() }
Index ¶
- Variables
- type App
- func (a *App) AddRouter(r ...*router.Router) *App
- func (a *App) AddRouterGroup(g ...*router.Group) *App
- func (a *App) Controller(c ...rest.Controller) *App
- func (a *App) Delete(pattern string, handler func(ctx *context.Context)) *App
- func (a *App) FSResource(fs *embed.FS, pattern, file, contentType string) *App
- func (a *App) FaviconFS(fs *embed.FS) *App
- func (a *App) FaviconFile(file string) *App
- func (a *App) Get(pattern string, handler func(ctx *context.Context)) *App
- func (a *App) Head(pattern string, handler func(ctx *context.Context)) *App
- func (a *App) Middlewares() []middleware.Middleware
- func (a *App) Options(pattern string, handler func(ctx *context.Context)) *App
- func (a *App) Patch(pattern string, handler func(ctx *context.Context)) *App
- func (a *App) Post(pattern string, handler func(ctx *context.Context)) *App
- func (a *App) Put(pattern string, handler func(ctx *context.Context)) *App
- func (a *App) RecoveryConfig(codeName string, codeVal int, msgName string) *App
- func (a *App) RecoveryHandler(handlers ...func(ctx *context.Context)) *App
- func (a *App) Request(pattern string, handler func(ctx *context.Context)) *App
- func (a *App) Resource(pattern, file, contentType string) *App
- func (a *App) Route(method, pattern string, handler func(ctx *context.Context)) *App
- func (a *App) Run()
- func (a *App) Use(middlewares ...middleware.Middleware) *App
- func (a *App) UseFavicon() *App
- func (a *App) UseLogger() *App
- func (a *App) UseRecovery() *App
- func (a *App) UseSession(provider session.Provider, config *session.Config, listener *session.Listener) *App
- func (a *App) UseStatic(cache bool, root, prefix string) *App
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultApp = New()
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { ConfigFile string Config *config.Config // contains filtered or unexported fields }
App struct
func (*App) AddRouterGroup ¶
AddRouterGroup Add Group Routers
func (*App) Controller ¶
func (a *App) Controller(c ...rest.Controller) *App
Controller Route REST-ful Controller
func (*App) FSResource ¶
FSResource Route a resource
func (*App) Middlewares ¶
func (a *App) Middlewares() []middleware.Middleware
Middlewares Filter Middlewares
func (*App) RecoveryConfig ¶
RecoveryConfig Sets Recovery config
func (*App) RecoveryHandler ¶
RecoveryHandler Sets Recovery handler
Source Files ¶
Click to show internal directories.
Click to hide internal directories.