hypnguyen1209 / ming

Custom HTTP Mux lightweight and high performance πŸ₯—

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 πŸ₯—

License:MIT License


Languages

Language:Go 95.3%Language:HTML 4.7%