restructuring
This commit is contained in:
@@ -1,20 +1,21 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"crowsnest/internal/routes"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
||||
type App struct {}
|
||||
|
||||
func main() {
|
||||
// routes
|
||||
http.HandleFunc("GET /", routes.Index)
|
||||
http.HandleFunc("POST /up/search", routes.UpSearch)
|
||||
app := &App{}
|
||||
|
||||
// serve files from the "static" directory
|
||||
fs := http.FileServer(http.Dir("assets/static"))
|
||||
http.Handle("GET /static/", http.StripPrefix("/", fs))
|
||||
server := http.Server{
|
||||
Addr: ":8080",
|
||||
Handler: app.routes(),
|
||||
}
|
||||
|
||||
// start server
|
||||
http.ListenAndServe(":8080", nil)
|
||||
server.ListenAndServe()
|
||||
log.Println("server started, listening on :8080")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user