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

gofury/fusion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)
    )
}