# Newifi
# 在路由器上跑golang
通过 uname -m 我们可以看出来,cpu架构为 mpis 。 我们查到 golang支持 (opens new window)
我们写个 hello world 试一下。
# file openwrt.go
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("hello world"))
return
})
fmt.Println("start listen")
http.ListenAndServe(":12345", nil)
}
编译
$ GOOS=linux GOARCH=mipsle go build openwrt.go