Skip to content

obgnail/http-server-toy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

http-server玩具

usage:

package main

import (
	"fmt"
	"github.com/obgnail/http-server-toy/context"
	"github.com/obgnail/http-server-toy/engine"
	"net/http"
)

func main() {
	eng := engine.Default()
	eng.GET("/echo/:name", func(ctx *context.Context) {
		ctx.GetResponse().SetHeader("testHeader", "hello")
		ret := fmt.Sprintf("hello, %s", ctx.GetParams()["name"])
		ctx.JSON(http.StatusOK, ret)
	})

	eng.Run("0.0.0.0", 6666)
}

About

模仿gin的http-server玩具

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages