diff options
author | xengineering <me@xengineering.eu> | 2022-11-05 21:25:31 +0100 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2022-11-07 21:17:44 +0100 |
commit | 1d6b45bebea66391a2a535a3bb328a5732aaa75d (patch) | |
tree | 12faa62d8d8574ad8c94f4a7c9ff206c34456430 /web/router.go | |
download | ceres-1d6b45bebea66391a2a535a3bb328a5732aaa75d.tar ceres-1d6b45bebea66391a2a535a3bb328a5732aaa75d.tar.zst ceres-1d6b45bebea66391a2a535a3bb328a5732aaa75d.zip |
Add existing work
Diffstat (limited to 'web/router.go')
-rw-r--r-- | web/router.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/web/router.go b/web/router.go new file mode 100644 index 0000000..b26dc88 --- /dev/null +++ b/web/router.go @@ -0,0 +1,27 @@ + +package web + +import ( + "log" + "net/http" + + "xengineering.eu/ceres/utils" +) + +func RunServer(config utils.HttpConfig, db *utils.Database) { + + http.HandleFunc("/", index(db, config.Templates)) + + http.HandleFunc("/recipe", recipe(db, config.Templates)) + + http.HandleFunc("/recipe/image", image(config.Storage)) + + http.HandleFunc("/add_recipes", add_recipes(db, config.Storage, config.Static)) + + http.HandleFunc("/static/libweb.css", static("libweb.css", config.Static)) + http.HandleFunc("/favicon.ico", static("favicon.ico", config.Static)) + + address := config.Host + ":" + config.Port + log.Println("Binding to 'http://" + address) + log.Fatal(http.ListenAndServe(address, nil)) +} |