Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Latest commit

 

History

History
42 lines (30 loc) · 1.28 KB

README.md

File metadata and controls

42 lines (30 loc) · 1.28 KB

Fusion

Build Status Code Climate GoDoc

Middleware chaining for valyala/fasthttp. Works for both:

  1. Traditional Middlewares: func Middleware(h RequestHandler) RequestHandler
  2. Pure RequestHandler: func Handler(ctx *RequestCtx)

This library is very much inspired by [alice]

Usage

Sample code:

import (
    "github.com/valyala/fasthttp"
    "github.com/gofury/fusion"
)

func main() {
	router := furyrouter.New()
	
    router.GET("/admin", 
        // chain handlers is a simple function call
        fusion.Handlers(Handler1, Handler2, Handler2)
    )

    
    fasthttp.ListenAndServe(":8000", 
        // chain middleware requires a new struct
        fusion.New(Middleware1, Middleware2, Middleware3).Then(router)
    )
}