20 lines
393 B
Go
20 lines
393 B
Go
|
|
package main
|
||
|
|
|
||
|
|
import (
|
||
|
|
"net/http"
|
||
|
|
)
|
||
|
|
|
||
|
|
func (app *App) routes() http.Handler {
|
||
|
|
mux := http.NewServeMux()
|
||
|
|
|
||
|
|
// dynamic routes
|
||
|
|
mux.HandleFunc("GET /", app.Index)
|
||
|
|
mux.HandleFunc("POST /up/search", app.UpSearch)
|
||
|
|
|
||
|
|
// serve files from the "static" directory
|
||
|
|
fs := http.FileServer(http.Dir("assets/static"))
|
||
|
|
mux.Handle("GET /static/", http.StripPrefix("/", fs))
|
||
|
|
|
||
|
|
return mux
|
||
|
|
}
|