6_middleware

command
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package main will explore the helpers for middleware(s) that Muxie has to offer, but they are totally optional, you can still use your favourite pattern to wrap route handlers.

Example of usage of an external net/http common middleware:

import "github.com/rs/cors"

mux := muxie.New() mux.Use(cors.Default().Handler)

To wrap a specific route or even if for some reason you want to wrap the entire router use the `Pre(middlewares...).For(mainHandler)` as :

wrapped := muxie.Pre(cors.Default().Handler, ...).For(mux) http.ListenAndServe(..., wrapped)

Jump to

Keyboard shortcuts

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