-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
47 lines (36 loc) · 1.09 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
package main
import (
"github.com/MaksymPrymierov/blog/routes"
"github.com/go-martini/martini"
)
func main() {
/* Init default server data */
m := routes.Init()
/* Static file */
staticOpt := martini.StaticOptions{Prefix: "assets"}
m.Use(martini.Static("assets", staticOpt))
/* Home Routes */
m.Get("/", routes.IndexHandler)
/* Posts Routes */
m.Get("/write", routes.WriteHandler)
m.Post("/createPost", routes.CreatePostHandler)
m.Get("/editPost/:id", routes.EditPostHandler)
m.Get("/readPost/:id", routes.ReadPostHandler)
m.Get("/deletePost/:id", routes.DeletePostHandler)
/* Auth Routes */
m.Get("/login", routes.GetLoginHandler)
m.Post("/login", routes.PostLoginHandler)
m.Get("/exit", routes.ExitSessionHandler)
/* Reg Routes */
m.Get("/register", routes.GetRegisterHandler)
m.Post("/register", routes.PostRegisterHandler)
/* Error Routes */
m.Get("/error/:id", routes.ErrorHandler)
/* Message Routes */
m.Get("/message/:id", routes.MessageHandler)
/* Admin Panel Routes */
m.Get("/admin", routes.AdminHandler)
/* Listen port and run server*/
m.RunOnAddr(":80")
m.Run()
}