diff options
Diffstat (limited to 'router.go')
-rw-r--r-- | router.go | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -6,7 +6,7 @@ import ( "net/http" ) -func RunServer(config HttpConfig, db *Database) { +func setupRoutes(config HttpConfig, db *Database) { http.HandleFunc("/", indexMux(db, config.Templates)) http.HandleFunc("/recipe", recipeMux(db, config.Templates)) @@ -15,7 +15,11 @@ func RunServer(config HttpConfig, db *Database) { http.HandleFunc("/add_recipes", addRecipesMux(db, config.Storage, config.Static)) http.HandleFunc("/static/style.css", staticStyleMux("style.css", config.Static)) http.HandleFunc("/favicon.ico", faviconMux("favicon.ico", config.Static)) +} + +func runServer(config HttpConfig, db *Database) { + setupRoutes(config, db) address := config.Host + ":" + config.Port log.Println("Binding to 'http://" + address) log.Fatal(http.ListenAndServe(address, nil)) |