gofury

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2016 License: MIT Imports: 7 Imported by: 0

README

FastMVC

composable, mvc library for fasthttp. Inspired dropwizard and utron

Features

  • Offer a set of reusable libraries similar to gorilla libraries for net/http
  • Designed to be 12factor compliant from the ground up
  • Both server and router are zero memory allocation and byte slice optimised
  • Non intrusive and freely compatible with any fasthttp.RequestHandler based code or Middleware

Friends

FastMVC is a composition glue between the following awesome libraries:

  • fasthttp for zero mem alloc http server
  • furyroad zero mem alloc router
  • fusion middleware chaining
  • envconfig environment variable based config
  • apex/log simple, handler based structured logging
  • glide for depedency management that makes sense

Testing is made easier with:

Other options libraries:

Usage

To import the project, use either glide

glide get github.com/gofury/gofury

or go get

go get github.com/gofury/gofury

Build the project

go test $(glide novendor)

Todo

  • db migration
  • metrics and healthcheck
  • views

Alternatives

Some other fasthttp based frameworks

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

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

func NewApplication

func NewApplication(name string, config Config, l *log.Logger, h fasthttp.RequestHandler) *Application

func (*Application) Start

func (app *Application) Start()

type BaseConfig

type BaseConfig struct {
	Host     string `default:""`
	Port     string `default:"8080"`
	LogLevel string `default:"info"`
}

func (*BaseConfig) ListenerAddr

func (c *BaseConfig) ListenerAddr() string

func (*BaseConfig) LoadConfig

func (c *BaseConfig) LoadConfig()

func (*BaseConfig) ParseLogLevel

func (c *BaseConfig) ParseLogLevel() log.Level

type BaseController

type BaseController struct {
}

func (*BaseController) MarshalResponse

func (c *BaseController) MarshalResponse(payload Model, status int) fasthttp.RequestHandler

func (*BaseController) UnmarshalRequest

func (c *BaseController) UnmarshalRequest(payload Model) fasthttp.RequestHandler

type Config

type Config interface {
	LoadConfig()
	ListenerAddr() string
	ParseLogLevel() log.Level
}

type Controller

type Controller interface {
	UnmarshalRequest(m Model) fasthttp.RequestHandler
	MarshalResponse(m Model, status int) fasthttp.RequestHandler
}

type HttpError

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

func NewHttpError

func NewHttpError(err error, status int) *HttpError

type Model

type Model interface {
	UnmarshalJSON([]byte) error
	MarshalJSON() ([]byte, error)
	Reset()
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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