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) {
...
}

你可能感兴趣的:(Golang 简单web测试)