refactor: restructure in entirety
This commit is contained in:
@@ -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))
|
||||
Reference in New Issue
Block a user