-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
61 lines (57 loc) · 2.07 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package main
import (
"go_web/webapp/project_bookstore/controller"
"net/http"
)
func main() {
//设置处理静态资源
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("views/static"))))
http.Handle("/pages/", http.StripPrefix("/pages/", http.FileServer(http.Dir("views/pages"))))
//主页面
http.HandleFunc("/main", controller.GetPageBooksByPrice)
//去登录
http.HandleFunc("/login", controller.Login)
//去注销
http.HandleFunc("/logout", controller.Logout)
//去注册
http.HandleFunc("/regist", controller.Regist)
//通过Ajax请求验证用户名是否可用
http.HandleFunc("/checkUsername", controller.CheckUsername)
//获取所有图书
//http.HandleFunc("/getBooks", controller.GetBooks)
//获取带分页的图书信息
http.HandleFunc("/getPageBooks", controller.GetPageBooks)
//
http.HandleFunc("/getPageBooksByPrice", controller.GetPageBooksByPrice)
////添加图书
//http.HandleFunc("/addBook", controller.AddBook)
//删除图书
http.HandleFunc("/deleteBook", controller.DeleteBook)
//去更新图书的页面
http.HandleFunc("/toUpdateBookPage", controller.ToUpdateBookPage)
//更新/添加图书
http.HandleFunc("/updateOraddBook", controller.UpdateOrAddBook)
//添加图书到购物车
http.HandleFunc("/addBook2Cart", controller.AddBook2Cart)
//获取购物车信息
http.HandleFunc("/getCartInfo", controller.GetCartInfo)
//清空购物车
http.HandleFunc("/deleteCart", controller.DeleteCart)
//删除购物项
http.HandleFunc("/deleteCartItem", controller.DeleteCartItem)
//更新购物项
http.HandleFunc("/updateCartItem", controller.UpdateCartItem)
//去结账
http.HandleFunc("/checkout", controller.Checkout)
//获取所有订单
http.HandleFunc("/getOrders", controller.GetOrders)
//获取订单详情
http.HandleFunc("/getOrderInfo", controller.GetOrderInfo)
//获取我的订单
http.HandleFunc("/getMyOrders", controller.GetMyOrders)
//发货
http.HandleFunc("/sendOrder", controller.SendOrder)
//确认收货
http.HandleFunc("/takeOrder", controller.TakeOrder)
http.ListenAndServe(":8080", nil)
}