Beispiel #1
0
func runWeb(c *cli.Context) {
	if c.IsSet("config") {
		setting.CustomConf = c.String("config")
	}
	controllers.GlobalInit()
	m := newMacaron()

	m.Get("/", controllers.Home)
	m.Get("/feed.json", catalog.AllFeedJSON)
	m.Get("/ok.json", func(c *macaron.Context) { c.JSON(200, "ok") })

	m.Group("/cat", func() {
		m.Get("/", catalog.Index)
		m.Get("/page/:p", catalog.Index)
		m.Get("/:id", catalog.Show).Name("cat_item")
		m.Get("/:id/feed", catalog.Feed)
		m.Get("/:id/feed/page/:p", catalog.Feed)
		m.Get("/:id/feed/:feedId", catalog.FeedShow)
		m.Get("/screen/:id", catalog.Screen)

		m.Get("/:id/setfeed", catalog.SetFeed).Name("set_feed")

		m.Any("/submit", catalog.Submit)
	})

	m.Get("/resize/*", catalog.Resize)

	m.Post("/upload", controllers.Upload)

	m.Run(5000)
}