-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
41 lines (32 loc) · 991 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
29
30
31
32
33
34
35
36
37
38
39
40
41
// blog.lesnoy.name project main.go
package main
import (
"fmt"
"github.com/hhh0pE/go-blog/routing"
"github.com/hhh0pE/go-blog/routing/actions"
"net/http"
_ "net/http/pprof"
)
func main() {
go func() {
fmt.Println(http.ListenAndServe("localhost:9002", nil))
}()
host := "localhost:9001"
fmt.Println("starting server " + host + "..")
routing.RouteDirectory("assets")
routing.Route("/", actions.Root)
routing.Route("/login/", actions.Login)
routing.Route("/logout/", actions.Logout)
routing.RouteFunc("/rss/{category}/", actions.Rss)
routing.Route("/api/{entity}/", actions.Api)
routing.Route("/{category}/", actions.Category)
routing.Route("/{category}/{post_url}/", actions.Post)
// routing.Route("/rss/", actions.Rss)
routing.RouteFile("/sitemap.xml", "public/sitemap.xml")
routing.RouteFile("/robots.txt", "public/robots.txt")
err := http.ListenAndServe(host, routing.Router())
if err != nil {
fmt.Println("Error serving " + host)
fmt.Println(err)
}
}