refactor: restructure in entirety

This commit is contained in:
Arkaprabha Chakraborty
2025-12-06 15:31:18 +05:30
parent 28733e22d3
commit 17a2bce744
43 changed files with 854 additions and 1342 deletions

View File

@@ -10,6 +10,7 @@ import (
"time"
"billit/internal/server"
"billit/web"
)
func gracefulShutdown(apiServer *http.Server, done chan bool) {
@@ -39,7 +40,7 @@ func gracefulShutdown(apiServer *http.Server, done chan bool) {
func main() {
server := server.NewServer()
server := server.NewServer(web.Files)
// Create a done channel to signal when the shutdown is complete
done := make(chan bool, 1)
@@ -47,6 +48,7 @@ func main() {
// Run graceful shutdown in a separate goroutine
go gracefulShutdown(server, done)
log.Printf("Server is starting on %s", server.Addr)
err := server.ListenAndServe()
if err != nil && err != http.ErrServerClosed {
panic(fmt.Sprintf("http server error: %s", err))