// initServer initialize and start the web server. func initServer(db *client.DbClient) { // Initialize the API controller controllers.Init(db) // Staticbin middleware goji.Use(gojistaticbin.Staticbin("static", Asset, gojistaticbin.Options{ SkipLogging: true, IndexFile: "index.html", })) // Httpauth middleware if options.AuthUser != "" && options.AuthPass != "" { goji.Use(httpauth.SimpleBasicAuth(options.AuthUser, options.AuthPass)) } goji.Get("/api/info", controllers.Info) goji.Get("/api/table", controllers.Tables) goji.Get("/api/table/:name", controllers.Table) goji.Get("/api/table/:name/info", controllers.TableInfo) goji.Get("/api/table/:name/sql", controllers.TableSql) goji.Get("/api/table/:name/indexes", controllers.TableIndexes) goji.Get("/api/query", controllers.Query) goji.Post("/api/query", controllers.Query) address := fmt.Sprintf("%s:%d", options.HttpHost, options.HttpPort) flag.Set("bind", address) go goji.Serve() }
func main() { goji.Use(gojistaticbin.Staticbin("static", Asset, gojistaticbin.Options{ SkipLogging: false, IndexFile: "index.html", })) goji.Serve() }