A very simplified Mux focused for ease of use.

hyper-mux

A very simplified Mux focused for ease of use.

go get github.com/hyperjumptech/hyper-mux

How to use the Mux

The following is how you going to use Hyper-Mux with vanilla http.Server

import (
    mux "github.com/hyperjumptech/hyper-mux"
    "net/http"
)

var (
    hmux := mux.NewHyperMux()	
)

...
theServer := &http.Server{
    Addr:     "0.0.0.0:8080",
    Handler:  hmux,
}
err := theServer.ListenAndServe()
if err != nil {
    panic(err.Error())
}
...

Adding Routes

First we create the route's handler function

func HandleHelloHyperMux(w http.ResponseWriter, r *http.Request) {
    hmux.WriteString(w, http.StatusOK, "Hello Hyper-Mux")
}

Then we map the HandleFunc function to the route

hmux.AddRoute("/", hmux.MethodGet, HandleHelloHyperMux)

Using Middleware

First we create the middleware

func ContextSetter(next http.Handler) http.Handler {
    return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        next.ServeHTTP(w,r)
        fmt.Println("POST CALL")
    })
}

Then we add it to our middleware chain

hmux.UseMiddleware(ContextSetter)
Owner
Hyperjump
Open-source first. Cloud native. DevOps excellence.
Hyperjump
Similar Resources

DO NOT use `named return values` in Go

namedreturn DO NOT use named return values in Go namedreturn finds a named return value, you must remove it.

Dec 17, 2021

To run a .go file use below syntax

To run a .go file use below syntax

Nov 2, 2021

code that I re-use among many Go projects

A bunch of Go packages that I use in multiple projects. An overview of packages: u : utility functions that I use all the time. Very short package nam

Dec 30, 2022

Go 1.18 generics use cases and examples

Go 1.18 generics use cases What are generics? See Type Parameters Proposal. How to run the examples? As of today, gotip is the simplest way to run the

Jan 10, 2022

Use is a go utility library using go1.18 generics

use use is a go utility library using go1.18 generics created by halpdesk 2022-01-22 use/slice Map updates a slice by applying a function to all membe

Jan 22, 2022

Color lets you use colorized outputs in terms of ANSI Escape Codes in Go (Golang)

Color lets you use colorized outputs in terms of ANSI Escape Codes in Go (Golang)

Color lets you use colorized outputs in terms of ANSI Escape Codes in Go (Golang). It has support for Windows too! The API can be used in several ways, pick one that suits you.

Feb 5, 2022

Easy to use open source hardware to drive WS2811 LEDs with high-quality color

STOP DOING FADECANDY LEDs were not supposed to be given data pins YEARS of "temporal dithering" but no real-world use found for having more than three

Dec 29, 2022

Nuke-Net is a VERY VERY over powered and ridiculous web crawler that is well- very very noisy XD read more here

Nuke-Net is a VERY VERY over powered and ridiculous web crawler that is well- very very noisy XD read more here

Nuke-Net is a VERY VERY over powered and ridiculous web crawler that is well- very very noisy XD read more here

Dec 20, 2021

A tiny Nano wallet, focused on ease of use through simplicity

atto is a tiny Nano wallet, which focuses on ease of use through simplicity. Disclaimer: I am no cryptographer and atto has not been audited. I cannot

Nov 14, 2022

golang csrf react example, using gorilla/mux and gorilla/mux

Demo REST backend Gorilla csrf middleware and Js frontend Use gorilla/mux and gorilla/csrf How to run open goland IDE, run middleware_test.go by click

Feb 2, 2022

A very very simple CLI tool to know the next and previous SpaceX flights.

Rocket A very very simple CLI tool to know the next and previous SpaceX flights. Commands rocket Get the next flight. rocket latest Get the last fligh

Apr 19, 2021

A very simple and powerful package for making REST requests with very little effort

Welcome to KRest KRest stands for Keep it simple REST Package. It's a very simple and powerful package wrapper over the standard http package for maki

Dec 1, 2022

Go-Suit is a very very wacky version of a bash terminal but in go, however with a little twitst

Go-Suit Go-Suit is a very very wacky version of a bash terminal but in go, however with a little twitst languages - Go-Lang packages Third Party - g

May 19, 2022

Use controllers with the Gorilla Mux library

Gorilla Controllers Use controllers with the Gorilla Mux library Why controllers? Gorilla's mux library is a brilliant fully featured mux tool, Gorill

Nov 22, 2022

Distributed lock manager. Warning: very hard to use it properly. Not because it's broken, but because distributed systems are hard. If in doubt, do not use this.

What Dlock is a distributed lock manager [1]. It is designed after flock utility but for multiple machines. When client disconnects, all his locks are

Dec 24, 2019

GraphQL server with a focus on ease of use

GraphQL server with a focus on ease of use

graphql-go The goal of this project is to provide full support of the GraphQL draft specification with a set of idiomatic, easy to use Go packages. Wh

Dec 31, 2022

GraphQL server with a focus on ease of use

GraphQL server with a focus on ease of use

graphql-go The goal of this project is to provide full support of the GraphQL draft specification with a set of idiomatic, easy to use Go packages. Wh

Dec 25, 2022

Nuclei is a fast tool for configurable targeted vulnerability scanning based on templates offering massive extensibility and ease of use.

Nuclei is a fast tool for configurable targeted vulnerability scanning based on templates offering massive extensibility and ease of use.

Fast and customisable vulnerability scanner based on simple YAML based DSL. How • Install • For Security Engineers • For Developers • Documentation •

Dec 30, 2022

The power of curl, the ease of use of httpie.

The power of curl, the ease of use of httpie.

Curlie If you like the interface of HTTPie but miss the features of curl, curlie is what you are searching for. Curlie is a frontend to curl that adds

Dec 27, 2022
Related tags
Split multiple Kubernetes files into smaller files with ease. Split multi-YAML files into individual files.

Split multiple Kubernetes files into smaller files with ease. Split multi-YAML files into individual files.

Dec 29, 2022
Split multiple Kubernetes files into smaller files with ease. Split multi-YAML files into individual files.

kubectl-slice: split Kubernetes YAMLs into files kubectl-slice is a neat tool that allows you to split a single multi-YAML Kubernetes manifest into mu

Jan 3, 2023
Di - A (very) WIP Go 1.18+ generic dependency injection package based on type reflection

di A (very) WIP Go 1.18+ generic dependency injection package based on type refl

Apr 26, 2022
Helpers for making the use of reflection easier

go-xray This is a Golang library with reflection related functions which I use in my different projects. KeyValue This type is used to construct a key

Oct 24, 2022
Use Golang to implement PHP's common built-in functions.

PHP2Go Use Golang to implement PHP's common built-in functions. About 140+ functions have been implemented. Install go get github.com/syyongx/php2go R

Dec 28, 2022
Robust & Easy to use struct mapper and utility methods for Go

go-model Robust & Easy to use model mapper and utility methods for Go struct. Typical methods increase productivity and make Go development more fun ?

Dec 30, 2022
🚀 Use Lanyard API easily in your Go app!

?? Go Lanyard Use Lanyard API easily in your Go app! ?? Installation Initialize your project (go mod init example.com/example) Add package (go get git

Mar 11, 2022
Go linter to check the struct literal to use field name

Structfield Find struct literals using non-labeled fields. The structfield analysis reports the usage of struct literal using non-labeled fields more

Aug 23, 2021
Infrastructure supporting the use of Go in Microsoft

Microsoft Go Infrastructure This repository contains libraries and utilities that Microsoft uses to: Build Go inside Microsoft infrastructure using up

Dec 15, 2022
Easy to use, light enough, good performance Golang library
 Easy to use, light enough, good performance Golang library

指令使用 特性 简单易用、足够轻量,避免过多的外部依赖,最低兼容 Window 7 等老系统 快速上手 安装 $ go get github.com/sohaha/zlsgo HTTP 服务 // main.go

Dec 29, 2022