bew

package module
v0.0.0-...-7fde89f Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2013 License: MIT Imports: 10 Imported by: 0

README

bew

a simple web framework in Go

TODO

  • get & set cookie
  • make context optional
  • easy access to request data
  • easy way to return a templated response

Documentation

Overview

server and route

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(route string, handler interface{})

func Get

func Get(route string, handler interface{})

func Post

func Post(route string, handler interface{})

func Put

func Put(route string, handler interface{})

func Run

func Run(bind string)

Types

type Context

type Context struct {
	Request *http.Request
	Server  *Server
	Params  url.Values
	Json    *simplejson.Json
	http.ResponseWriter
}

func (*Context) Abort

func (ctx *Context) Abort(status int, body string)

func (*Context) BadRequest

func (ctx *Context) BadRequest()

func (*Context) Cookie

func (ctx *Context) Cookie(name string) string

func (*Context) Init

func (ctx *Context) Init()

func (*Context) NotFound

func (ctx *Context) NotFound()

func (*Context) Redirect

func (ctx *Context) Redirect(status int, url string)

func (*Context) SetCookie

func (ctx *Context) SetCookie(cookie *Cookie)
type Cookie struct {
	Name     string
	Value    string
	Path     string
	Domain   string
	Expires  time.Time
	MaxAge   int
	Secure   bool
	HttpOnly bool
}

func (*Cookie) ToHttpCookie

func (c *Cookie) ToHttpCookie() (cookie *http.Cookie)

type Server

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

func NewServer

func NewServer() (s *Server)

func (*Server) Delete

func (s *Server) Delete(r string, handler interface{})

func (*Server) Get

func (s *Server) Get(r string, handler interface{})

func (*Server) Post

func (s *Server) Post(r string, handler interface{})

func (*Server) Put

func (s *Server) Put(r string, handler interface{})

func (*Server) Run

func (s *Server) Run(bind string)

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(c http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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