示例#1
0
文件: main.go 项目: goarne/blog
func createFindArticleHtmlRoute() *web.Route {
	r := web.NewRoute()
	r.Path("/article/{id}")
	r.Header("Accept", "html")
	r.Method("GET")
	r.Handler(handler.NewHtmlTemplateHandler())
	return r
}
示例#2
0
文件: main.go 项目: goarne/blog
func createListArticleHtmlRoute() *web.Route {
	r := web.NewRoute()
	r.Path("/blog/article/list/")
	r.Method("GET")
	r.Header("Accept", "html")
	r.Handler(handler.NewHtmlTemplateHandler())
	return r
}
示例#3
0
文件: main.go 项目: goarne/blog
//Creates a html route
func createNewArticleHtmlRoute() *web.Route {
	r := web.NewRoute()
	r.Path("/new_article.html")
	r.Method("POST")
	r.Header("Accept", "html")
	r.Handler(handler.NewHtmlTemplateHandler())
	return r
}
示例#4
0
文件: main.go 项目: goarne/blog
func createJsonRoute() *web.Route {
	r := web.NewRoute()
	r.Path("/blog/article/{id}")
	r.Method("POST").Method(web.HttpPost).Method("PUT").Method("DELETE").Method("OPTIONS")
	r.Header("Accept", "json")

	r.Handler(handler.NewRestHandler())
	return r
}
示例#5
0
//Oppretter REST ressurs for applikasjon
func opprettIsolatRessurs(appConfig core.AppConfig) *web.WebRouter {
	r := web.NewRoute()

	r.Path(appConfig.Server.Root)
	r.Method(web.HttpGet).Method(web.HttpPost)
	r.Handler(core.NyRestHandler())

	router := web.NewWebRouter()
	router.AddRoute(r)
	return router
}
示例#6
0
文件: main.go 项目: goarne/blog
func createChainedHtmlRoute() *web.Route {
	r := web.NewRoute()
	r.Path("/")
	r.PathPrefix("/*.html")
	r.PathPrefix("/css/")
	r.PathPrefix("/ckeditor/")
	r.PathPrefix("/img/")
	r.PathPrefix("/fonts/")
	r.PathPrefix("/js/")
	r.PathPrefix("/less/")
	r.PathPrefix("/mail/")
	r.Method("GET")

	hc := &web.HandlerChain{}

	hc.Add(handler.NewStaticHtmlHandler("index.html"))
	hc.Add(handler.NewFileHandler("./html/"))
	r.Handler(hc)
	return r
}