package main

import (
	"log"
	"net/http"
)

func setupRoutes() {

	http.HandleFunc("/", indexMux())
	http.HandleFunc("/recipe", recipeMux())
	http.HandleFunc("/recipe/edit", recipeEditMux())
	http.HandleFunc("/recipe/image", recipeImageMux())
	http.HandleFunc("/add_recipes", addRecipesMux())
	http.HandleFunc("/static/style.css", staticStyleMux())
	http.HandleFunc("/favicon.ico", faviconMux())
}

func runServer() {

	setupRoutes()
	address := config.Http.Host + ":" + config.Http.Port
	log.Println("Binding to 'http://" + address)
	log.Fatal(http.ListenAndServe(address, nil))
}