-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathmain.go
More file actions
28 lines (24 loc) · 689 Bytes
/
Copy pathmain.go
File metadata and controls
28 lines (24 loc) · 689 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package main // import "github.com/po3rin/github_link_creator"
import (
_ "image/jpeg"
"net/http"
"os"
"github.com/apex/gateway"
"github.com/po3rin/github_link_creator/external"
"github.com/po3rin/github_link_creator/handler"
"github.com/po3rin/github_link_creator/infrastructure"
"github.com/po3rin/github_link_creator/lib/env"
l "github.com/po3rin/github_link_creator/lib/logger"
)
func main() {
r := infrastructure.NewRouter()
r.Handler = handler.Handler{
Repo: external.NewRepository(),
}
router := r.InitRouter()
if os.Getenv("LAMBDA") == "true" {
l.Fatal(gateway.ListenAndServe(env.Port, router))
} else {
l.Fatal(http.ListenAndServe(env.Port, router))
}
}