2024-12-20 01:15:56 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
2025-01-02 15:05:20 +01:00
|
|
|
"crowsnest/internal/routes"
|
2024-12-30 15:45:40 +01:00
|
|
|
"net/http"
|
2024-12-20 01:15:56 +01:00
|
|
|
)
|
|
|
|
|
|
2025-01-02 00:35:41 +01:00
|
|
|
|
2024-12-20 01:15:56 +01:00
|
|
|
func main() {
|
2024-12-30 15:45:40 +01:00
|
|
|
// routes
|
2025-01-02 15:05:20 +01:00
|
|
|
http.HandleFunc("GET /", routes.Index)
|
|
|
|
|
http.HandleFunc("POST /up/search", routes.UpSearch)
|
2024-12-20 01:15:56 +01:00
|
|
|
|
2024-12-30 15:45:40 +01:00
|
|
|
// serve files from the "static" directory
|
2025-01-02 15:48:55 +01:00
|
|
|
fs := http.FileServer(http.Dir("assets/static"))
|
2025-01-02 15:05:20 +01:00
|
|
|
http.Handle("GET /static/", http.StripPrefix("/", fs))
|
2024-12-20 01:15:56 +01:00
|
|
|
|
2024-12-30 15:45:40 +01:00
|
|
|
// start server
|
|
|
|
|
http.ListenAndServe(":8080", nil)
|
2024-12-20 01:15:56 +01:00
|
|
|
}
|