-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.go
43 lines (36 loc) · 853 Bytes
/
app.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
package main
import (
R "voting/routes"
"github.com/kataras/iris"
)
// App -- the application root
func App() *iris.Application {
app := iris.New()
app.Get("/", func(ctx iris.Context) {
ctx.JSON("every thing ok")
})
s := app.Party("/session")
{
s.Post("/new", R.NewSession)
s.Put("/update", R.UpdateSession)
s.Post("/start", R.StartSession)
s.Post("/close", R.CloseSession)
s.Get("/", R.GetAllSession)
s.Get("/{id: string}", R.GetSession)
}
q := app.Party("/question")
{
q.Post("/new", R.NewQuestion)
q.Put("/update", R.UpdateQuestion)
q.Post("/startVote", R.VoteStart)
q.Post("/closeVote", R.VoteClose)
q.Post("/vote", R.Vote)
q.Get("/{question: string}", R.GetQuestion)
q.Get("/session/{session: string}", R.GetQuestionOfSession)
}
return app
}
func main() {
app := App()
app.Run(iris.Addr(":8080"))
}