migrated the webserver to go to keep my sanity

closes #12 #2
This commit is contained in:
odweta
2026-08-11 19:27:09 +02:00
parent e56ddc461b
commit 7ae0781430
608 changed files with 456 additions and 64005 deletions
+32
View File
@@ -0,0 +1,32 @@
package main
import (
"fmt"
"net/http"
"os"
"github.com/go-chi/chi/v5"
)
func main() {
connectDB()
router := chi.NewRouter()
router.Use(logMiddleware)
router.Use(authMiddleware)
// routes
router.Get("/tickets", getTickets)
router.Post("/tickets", createTicket)
router.Patch("/tickets/{id}", updateTicket)
//router.Delete("/tickets/{id}", deleteQuote) // leave for later?
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
fmt.Println("started and listening on localhost:" + port)
http.ListenAndServe(":"+port, router)
}