-
Notifications
You must be signed in to change notification settings - Fork 146
/
app.go
22 lines (17 loc) · 584 Bytes
/
app.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package web
import (
"fmt"
"github.com/chainHero/heroes-service/web/controllers"
"net/http"
)
func Serve(app *controllers.Application) {
fs := http.FileServer(http.Dir("web/assets"))
http.Handle("/assets/", http.StripPrefix("/assets/", fs))
http.HandleFunc("/home.html", app.HomeHandler)
http.HandleFunc("/request.html", app.RequestHandler)
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/home.html", http.StatusTemporaryRedirect)
})
fmt.Println("Listening (http://localhost:3000/) ...")
http.ListenAndServe(":3000", nil)
}