Skip to content

Commit

Permalink
Merge pull request #6 from Owbird/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Owbird authored Jul 1, 2024
2 parents 40afaec + 33da866 commit d2cb35a
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions internal/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package server
import (
"fmt"
"net/http"
"os"
"strconv"
"time"

"github.com/Owbird/KNUST-AIM-API/docs"
Expand All @@ -17,9 +15,12 @@ import (
ginSwagger "github.com/swaggo/gin-swagger"
)

type Server struct {
port int
}
const (
PORT = 8080
IP = "0.0.0.0"
)

type Server struct{}

func NewServer() *http.Server {
docs.SwaggerInfo.Title = "KNUST AIM API"
Expand All @@ -28,15 +29,12 @@ func NewServer() *http.Server {
docs.SwaggerInfo.Version = "1.0"
docs.SwaggerInfo.Schemes = []string{"http", "https"}

port, _ := strconv.Atoi(os.Getenv("PORT"))
NewServer := &Server{
port: port,
}
newServer := &Server{}

// Declare Server config
server := &http.Server{
Addr: fmt.Sprintf(":%d", NewServer.port),
Handler: NewServer.RegisterRoutes(),
Addr: fmt.Sprintf("%s:%d", IP, PORT),
Handler: newServer.RegisterRoutes(),
IdleTimeout: time.Minute,
ReadTimeout: 10 * time.Second,
WriteTimeout: 30 * time.Second,
Expand Down

0 comments on commit d2cb35a

Please sign in to comment.