go-bouquins/main.go
2017-07-30 20:17:18 +02:00

41 lines
736 B
Go

package main
import (
"net/http"
"meutel.net/meutel/go-bouquins/bouquins"
)
const (
INDEX = "/"
BOOKS = "/books"
AUTHORS = "/authors"
SERIES = "/series"
HTML = "/html/"
JS = "/js/"
CSS = "/css/"
)
func init() {
app := new(bouquins.Bouquins)
assets()
router(app)
}
func assets() {
http.Handle(HTML, http.FileServer(http.Dir("assets")))
http.Handle(JS, http.FileServer(http.Dir("assets")))
http.Handle(CSS, http.FileServer(http.Dir("assets")))
}
func router(app *bouquins.Bouquins) {
http.HandleFunc(INDEX, app.IndexPage)
http.HandleFunc(BOOKS, app.BooksPage)
http.HandleFunc(AUTHORS, app.AuthorsPage)
http.HandleFunc(SERIES, app.SeriesPage)
}
func main() {
http.ListenAndServe(":9000", nil)
}