Skip to content

Custom HTTP Mux lightweight and high performance 🥗

License

Notifications You must be signed in to change notification settings

hypnguyen1209/ming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ming

Custom HTTP Mux lightweight and high performance 🥗

Examples:

package main

import (
	"fmt"

	"github.com/hypnguyen1209/ming"
	"github.com/valyala/fasthttp"
)

func Home(ctx *fasthttp.RequestCtx) {
	ctx.WriteString("Home")
}

func AllHandler(ctx *fasthttp.RequestCtx) {
	ctx.WriteString("123")
}

func SearchHandler(ctx *fasthttp.RequestCtx) {
	q := string(ming.Query(ctx, "name"))
	fmt.Fprintf(ctx, "Hello %s", q)
}

func PostHandler(ctx *fasthttp.RequestCtx) {
	ctx.Write(ming.Body(ctx))
}

func main() {
	r := ming.New()
	r.Static("./", true)
	r.Get("/", Home)
	r.Post("/add", PostHandler)
	r.All("/all", AllHandler)
	r.Get("/search", SearchHandler)
	r.Run("127.0.0.1:8000")
    // r.Run(":8000")
}

Test

Source: https://github.com/smallnest/go-web-framework-benchmark

Base on

🎊 Inspired by

About

Custom HTTP Mux lightweight and high performance 🥗

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published