feat: initialize template

This commit is contained in:
2026-02-11 20:27:14 +01:00
parent c937be1274
commit bbae5b1c93
61 changed files with 396 additions and 4399 deletions
+34
View File
@@ -0,0 +1,34 @@
package server
import (
"fmt"
"net/http"
"os"
"strconv"
"time"
)
type Server struct {
port int
}
func NewServer() *http.Server {
port, _ := strconv.Atoi(os.Getenv("PORT"))
if port == 0 {
port = 8080
}
s := &Server{
port: port,
}
// Declare Server config
server := &http.Server{
Addr: fmt.Sprintf(":%d", s.port),
Handler: s.RegisterRoutes(),
IdleTimeout: time.Minute,
ReadTimeout: 10 * time.Second,
WriteTimeout: 30 * time.Second,
}
return server
}