mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-21 19:37:41 +00:00
fix web
This commit is contained in:
parent
7f30f279bc
commit
ff80ef3f2a
1 changed files with 6 additions and 4 deletions
|
@ -2,7 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"database/sql"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
|
@ -35,8 +34,6 @@ func main() {
|
|||
}
|
||||
|
||||
var cfg config
|
||||
flag.IntVar(&cfg.port, "port", 4000, "API server port")
|
||||
flag.Parse()
|
||||
|
||||
db, err := sql.Open("postgres", os.Getenv("DATABASE_URL"))
|
||||
if err != nil {
|
||||
|
@ -54,8 +51,13 @@ func main() {
|
|||
rc,
|
||||
}
|
||||
|
||||
port, ok := os.LookupEnv("PORT")
|
||||
if !ok {
|
||||
port = "4000"
|
||||
}
|
||||
|
||||
srv := &http.Server{
|
||||
Addr: fmt.Sprintf(":%d", cfg.port),
|
||||
Addr: fmt.Sprintf(":%s", port),
|
||||
Handler: app.routes(),
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue