Fix: stupid llm
This commit is contained in:
35
main.go
Normal file
35
main.go
Normal file
@ -0,0 +1,35 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"golias/handlers"
|
||||
"time"
|
||||
)
|
||||
|
||||
// TODO: add config as param
|
||||
func ListenToRequests(port string) error{
|
||||
mux := http.NewServeMux()
|
||||
server := &http.Server{
|
||||
Addr: port,
|
||||
ReadTimeout: time.Second * 5,
|
||||
WriteTimeout: time.Second * 5,
|
||||
}
|
||||
|
||||
fs := http.FileServer(http.Dir("assets/"))
|
||||
mux.Handle("GET /assets/", http.StripPrefix("/assets/", fs))
|
||||
|
||||
mux.HandleFunc("GET /ping", handlers.HandlePing)
|
||||
mux.HandleFunc("GET /", handlers.HandleHome)
|
||||
fmt.Println("Listening", "addr", port)
|
||||
return server.ListenAndServe()
|
||||
}
|
||||
|
||||
func main() {
|
||||
port := ":3000"
|
||||
fmt.Printf("Starting server on %s\n", port)
|
||||
err := ListenToRequests(port)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user