Documentation ¶
Index ¶
- Constants
- func Add(controllers ...interface{})
- func DefaultConfiguration() iris.Configuration
- func InitJwt(wd string) error
- func NewApplication(controllers ...interface{}) *application
- type Application
- type ApplicationContext
- type Context
- func (ctx *Context) Do(handlers context.Handlers)
- func (ctx *Context) HTML(htmlContents string) (int, error)
- func (ctx *Context) Next()
- func (ctx *Context) RequestBody(data interface{}) error
- func (ctx *Context) RequestEx(data interface{}, cb func() error) error
- func (ctx *Context) RequestForm(data interface{}) error
- func (ctx *Context) RequestParams(data interface{}) error
- func (ctx *Context) ResponseBody(message string, data interface{})
- func (ctx *Context) ResponseError(message string, code int)
- func (ctx *Context) ResponseString(data string)
- func (ctx *Context) Translate(format string, args ...interface{}) string
- type Controller
- type ExtendedContext
- type Health
- type JwtController
- type JwtMap
- type JwtMiddleware
- type TestApplication
- type Token
Constants ¶
const ( AuthType = "AuthType" AuthTypeDefault = "" AuthTypeAnon = "anon" AuthTypeJwt = "jwt" BeforeMethod = "Before" AfterMethod = "After" )
Variables ¶
This section is empty.
Functions ¶
func DefaultConfiguration ¶ added in v0.3.0
func DefaultConfiguration() iris.Configuration
DefaultConfiguration returns the default configuration for an iris station, fills the main Configuration
func InitJwt ¶
InitJwt init JWT, it read config/ssl/rsa and config/ssl/rsa.pub
func NewApplication ¶
func NewApplication(controllers ...interface{}) *application
NewApplication create new web application instance and init it
Types ¶
type Application ¶
type Application interface { Init(controllers ...interface{}) error Config() *starter.SystemConfiguration Run() }
ApplicationInterface is the interface of web application
type ApplicationContext ¶ added in v0.2.0
type ApplicationContext interface { context.Context ExtendedContext }
type Context ¶
type Context struct { // Optional Part 1: embed (optional but required if you don't want to override all context's methods) // it's the context/context.go#context struct but you don't need to know it. context.Context ExtendedContext }
Context Create your own custom Context, put any fields you wanna need.
func (*Context) Do ¶
Do: The only one important if you will override the Context with an embedded context.Context inside it. Required in order to run the handlers via this "*Context".
func (*Context) HTML ¶
HTML Override any context's method you want... [...]
func (*Context) Next ¶
func (ctx *Context) Next()
Next: The second one important if you will override the Context with an embedded context.Context inside it. Required in order to run the chain of handlers via this "*Context".
func (*Context) RequestBody ¶
RequestBody get RequestBody
func (*Context) RequestEx ¶ added in v0.2.0
RequestEx get RequestBody
func (*Context) RequestForm ¶ added in v0.2.0
RequestForm get RequestFrom
func (*Context) RequestParams ¶ added in v0.2.0
RequestParams get RequestParams
func (*Context) ResponseBody ¶
ResponseBody set response
func (*Context) ResponseError ¶
Response Errorset response
func (*Context) ResponseString ¶ added in v0.2.0
ResponseBody set response
type Controller ¶
Controller is the web base controller
func (*Controller) AuthType ¶
func (c *Controller) AuthType() string
type ExtendedContext ¶ added in v0.2.0
type Health ¶
type Health struct {
Status string `json:"status"`
}
Health is the health check struct
type JwtController ¶ added in v0.2.0
type JwtController struct {
Controller
}
JwtController is the base web controller that enabled JWT
func (*JwtController) AuthType ¶ added in v0.2.0
func (c *JwtController) AuthType() string
func (*JwtController) ParseToken ¶ added in v0.2.0
func (c *JwtController) ParseToken(claims jwt.MapClaims, prop string) string
ParseToken is an util that parsing JWT token from jwt.MapClaims
type JwtMiddleware ¶
type JwtMiddleware struct {
mwjwt.Middleware
}
JwtMiddleware derrived from github.com/iris-contrib/middleware/jwt/Middleware
func NewJwtMiddleware ¶ added in v0.2.0
func NewJwtMiddleware(cfg ...mwjwt.Config) *JwtMiddleware
NewJwtMiddleware New constructs a new Secure instance with supplied options.
func (*JwtMiddleware) CheckJWT ¶
func (m *JwtMiddleware) CheckJWT(ctx context.Context) error
CheckJWT the main functionality, checks for token
func (*JwtMiddleware) Serve ¶
func (m *JwtMiddleware) Serve(ctx context.Context)
Serve the middleware's action
type TestApplication ¶ added in v0.2.0
type TestApplication interface { Application RunTestServer(t *testing.T) *httpexpect.Expect Request(method, path string, pathargs ...interface{}) *httpexpect.Request Post(path string, pathargs ...interface{}) *httpexpect.Request Get(path string, pathargs ...interface{}) *httpexpect.Request Put(path string, pathargs ...interface{}) *httpexpect.Request Delete(path string, pathargs ...interface{}) *httpexpect.Request Patch(path string, pathargs ...interface{}) *httpexpect.Request }
TestApplicationInterface the test web application interface for unit test only
func NewTestApplication ¶ added in v0.2.0
func NewTestApplication(t *testing.T, controllers ...interface{}) TestApplication
NewTestApplication returns the new test application