-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
62 lines (51 loc) · 2.35 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
62
package main
import (
"fmt"
c "roomreserve/controllers"
"roomreserve/helpers"
_ "roomreserve/models"
"github.com/astaxie/beego"
"github.com/astaxie/beego/orm"
_ "github.com/lib/pq"
)
func init() {
orm.RegisterDriver("postgres", orm.DRPostgres)
orm.RegisterDataBase("default", "postgres",
"host="+beego.AppConfig.String("pgurls")+
" port="+beego.AppConfig.String("pgport")+
" user="+beego.AppConfig.String("pguser")+
" password="+beego.AppConfig.String("pgpass")+
" dbname="+beego.AppConfig.String("pgdb")+
" sslmode="+beego.AppConfig.String("pgsslmode"))
}
func main() {
name := "default"
force := false // Drop table and re-create.
verbose := true // Print log.
err := orm.RunSyncdb(name, force, verbose) // Error.
if err != nil {
fmt.Println(err)
}
beego.Router("/service/secure/json/", &c.ServiceController{}, "get:GetXSRF")
beego.Router("/login", &c.UserController{})
beego.Router("/logout", &c.LogoutController{})
beego.Router("/forget-password", &c.ForgetController{})
beego.Router("/", &c.HomeController{})
beego.Router("/calendar", &c.CalenendarController{})
beego.Router("/room/?:id", &c.RoomController{}, "get:Get;post:Post;delete:Delete")
beego.Router("/room/read/?:id", &c.RoomReadController{}, "get:Read")
beego.Router("/room/list", &c.RoomController{}, "get:RoomList;post:GetRoomListJSON")
beego.Router("/user/?:id", &c.UserManageController{}, "get:Get;post:Post;delete:Delete")
beego.Router("/profile", &c.UserManageController{}, "get:ProfileGet;post:ProfilePost")
beego.Router("/user/list", &c.UserManageController{}, "get:UserList;post:GetUserListJSON")
beego.Router("/role/?:id", &c.RoleController{}, "get:Get;post:Post;delete:Delete")
beego.Router("/role/list", &c.RoleController{}, "get:RoleList;post:GetRoleListJSON")
beego.Router("/reserve/?:id", &c.ReserveController{}, "get:Get;post:Post")
beego.Router("/reserve/view/?:id", &c.ReserveViewController{}, "get:View")
beego.Router("/reserve/file", &c.ReserveController{}, "post:FileAtt")
beego.Router("/reserve/dowload/?:id", &c.ReserveViewController{}, "get:FileDownload")
beego.Router("/reserve/delete/file/?:id", &c.ReserveController{}, "delete:FileDelete")
beego.Router("/reserve/list", &c.MyReserveController{}, "get:Get;post:Post")
beego.AddFuncMap("AddToThaiYear", helpers.AddToThaiYear)
beego.Run()
}