Separate run command from main function
This commit is contained in:
19
main.go
19
main.go
@ -1,24 +1,9 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/fossyy/filekeeper/middleware"
|
||||
"github.com/fossyy/filekeeper/routes"
|
||||
"github.com/fossyy/filekeeper/utils"
|
||||
"github.com/fossyy/filekeeper/app"
|
||||
)
|
||||
|
||||
func main() {
|
||||
serverAddr := fmt.Sprintf("%s:%s", utils.Getenv("SERVER_HOST"), utils.Getenv("SERVER_PORT"))
|
||||
server := http.Server{
|
||||
Addr: serverAddr,
|
||||
Handler: middleware.Handler(routes.SetupRoutes()),
|
||||
}
|
||||
|
||||
fmt.Printf("Listening on http://%s\n", serverAddr)
|
||||
err := server.ListenAndServe()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
app.Start()
|
||||
}
|
||||
|
Reference in New Issue
Block a user