-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
28 lines (26 loc) · 819 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package main
import (
"fmt"
"log"
"math/rand"
"net/http"
"time"
"wxcloudrun-golang/db"
"wxcloudrun-golang/handler"
)
func main() {
rand.Seed(time.Now().UnixNano())
if err := db.Init(); err != nil {
panic(fmt.Sprintf("mysql init failed with %+v", err))
}
// 他妈的原生http好麻烦
http.HandleFunc("/", handler.IndexHandler)
http.HandleFunc("/api/count", handler.CounterHandler)
http.HandleFunc("/api/listFoodMenu", handler.ListFoodMenu)
http.HandleFunc("/api/order/orderFood", handler.OrderFood)
http.HandleFunc("/api/order/GetMyOrder", handler.GetMyOrder)
http.HandleFunc("/api/user/getUserInfo", handler.GetUserInfo)
http.HandleFunc("/api/user/saveNickName", handler.SaveNickName)
http.HandleFunc("/api/user/saveIconURL", handler.SaveIconURL)
log.Fatal(http.ListenAndServe(":80", nil))
}