axe

package module
v0.0.0-...-f65b48a Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2017 License: MIT Imports: 21 Imported by: 0

README

axe

A HTTP web framework written in Go.

It's a little bit of opinionated glue code which bangs together a set of libraries which have historically not sucked:

  • viper Go configuration with fangs
  • mux A powerful URL router and dispatcher for golang.
  • session Package gorilla/sessions provides cookie and filesystem sessions and infrastructure for custom session backends.
  • csrf gorilla/csrf provides Cross Site Request Forgery (CSRF) prevention middleware for Go web applications & services.
  • renderGo package for easily rendering JSON, XML, binary data, and HTML templates responses.
  • gorm The fantastic ORM library for Golang, aims to be developer friendly
  • logrus Structured, pluggable logging for Go.
  • cli A simple, fast, and fun package for building command line apps in Go
  • validator Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving
  • form Decodes url.Values into Go value(s) and Encodes Go value(s) into url.Values. Dual Array and Full map support.
  • inject Package inject provides a reflect based injector.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORS

func CORS(debug bool, hnd http.Handler, hosts ...string) http.Handler

CORS cors header

func CSRF

func CSRF(key string, secure bool, hnd http.Handler) http.Handler

CSRF set csrf key

func FuncName

func FuncName(f interface{}) string

FuncName get func name

Types

type Context

type Context struct {
	Request *http.Request
	Writer  http.ResponseWriter
	Params  map[string]string
	Payload H
	// contains filtered or unexported fields
}

Context Context is the most important part of gin. It allows us to pass variables between middleware, manage the flow, validate the JSON of a request and render a JSON response for example.

func (*Context) Abort

func (p *Context) Abort(code int, err error)

Abort Abort prevents pending handlers from being called. Note that this will not stop the current handler.

func (*Context) Bind

func (p *Context) Bind(f interface{}) error

Bind bind json request

func (*Context) ClientIP

func (p *Context) ClientIP() string

ClientIP http client ip

func (*Context) Form

func (p *Context) Form(f interface{}) error

Form buind form request

func (*Context) HTML

func (p *Context) HTML(c int, l, n string, v H)

HTML render html

func (*Context) Header

func (p *Context) Header(k, v string)

Header set write header

func (*Context) JSON

func (p *Context) JSON(c int, v interface{})

JSON render json

func (*Context) Next

func (p *Context) Next()

Next Next should be used only inside middleware. It executes the pending handlers in the chain inside the calling handler.

func (*Context) TEXT

func (p *Context) TEXT(c int, n string, v interface{})

TEXT render text

func (*Context) XML

func (p *Context) XML(c int, v interface{})

XML render xml

type H

type H map[string]interface{}

H hash data

type HandlerFunc

type HandlerFunc func(*Context)

HandlerFunc http handler

type LayoutFunc

type LayoutFunc func(H) error

LayoutFunc prepare layout data

type Router

type Router struct {
	// contains filtered or unexported fields
}

Router http router

func NewRouter

func NewRouter() *Router

NewRouter create router

func (*Router) DELETE

func (p *Router) DELETE(path string, handlers ...HandlerFunc)

DELETE http delete

func (*Router) FuncMap

func (p *Router) FuncMap(n string, f interface{})

FuncMap set html template funcmap

func (*Router) GET

func (p *Router) GET(path string, handlers ...HandlerFunc)

GET http get

func (*Router) Group

func (p *Router) Group(path string, router *Router)

Group sub-router

func (*Router) Handler

func (p *Router) Handler(views string, debug bool) http.Handler

Handler http handle

func (*Router) PATCH

func (p *Router) PATCH(path string, handlers ...HandlerFunc)

PATCH http patch

func (*Router) POST

func (p *Router) POST(path string, handlers ...HandlerFunc)

POST http post

func (*Router) PUT

func (p *Router) PUT(path string, handlers ...HandlerFunc)

PUT http put

func (*Router) Resources

func (p *Router) Resources(path string, index, create, show, update, destroy []HandlerFunc)

Resources resources

func (*Router) Static

func (p *Router) Static(path, dir string)

Static static files

func (*Router) Use

func (p *Router) Use(handlers ...HandlerFunc)

Use use handlers

func (*Router) Walk

func (p *Router) Walk(f func(method, path string, handlers ...HandlerFunc) error) error

Walk walk routes

Directories

Path Synopsis
orm
job
orm
fs

Jump to

Keyboard shortcuts

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