Golang 简单web测试

// mhoso project main.go
package main

import (
	"log"
	"net/http"

	"./controller"
)

func main() {
	http.HandleFunc("/", controller.IndexFunc)
	http.HandleFunc("/search", controller.SearchFunc)
	err := http.ListenAndServe(":8080", nil)
	log.Println(err)
}

package controller

import (
	"io/ioutil"
	"log"
	"net/http"
)

func SearchFunc(w http.ResponseWriter, r *http.Request) {
...
}
posted @ 2018-12-03 20:19  波士地盘  阅读(303)  评论(0编辑  收藏  举报