Skip to content

Latest commit

 

History

History
31 lines (24 loc) · 436 Bytes

File metadata and controls

31 lines (24 loc) · 436 Bytes

安装 ,需要先安装 Go 并设置 Go 工作区。

  1. 下载并安装 xmux
go get -u github.com/hyahm/xmux
  1. 使用 xmux
package main

import (
	"net/http"

	"github.com/hyahm/xmux"
)

func main() {
	router := xmux.NewRouter()
	router.Get("/", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("<h1>hello world!<h1>"))
	})
	router.Run()
}

运行你的项目 go run main.go

hello world!