func (s HTTPServer) Run(proto string) { logger := initLogger(Settings.Log.File) redis := &redis.Client{Addr: Settings.Redis.Addr(), Db: Settings.Redis.DB, Password: Settings.Redis.Password} var ( indexHandler = &IndexHandler{} restHandler = &RestQueueHandler{redis, logger} wsHandler = &WSQueueHandler{redis, logger} ) web.Get("/", indexHandler.Get) web.Get("/q", restHandler.List) web.Get("/q/(.+)", restHandler.Get) web.Post("/q/(.+)", restHandler.Put) web.Delete("/q/(.+)", restHandler.Clear) web.Get("/ws/(.+)", wsHandler.Consumer) web.SetLogger(logger) addr := Settings.HTTPServer.Addr() switch proto { case "http": web.Run(addr) case "fcgi": web.RunFcgi(addr) case "scgi": web.RunScgi(addr) default: flag.Usage() os.Exit(1) } }
func main() { web.Get("/(.*)", generate) web.RunFcgi("127.0.0.1:9980") }