-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
32 lines (25 loc) · 524 Bytes
/
Copy pathmain.go
File metadata and controls
32 lines (25 loc) · 524 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
29
30
31
32
package main
import (
"embed"
"log"
"os"
"github.com/mrinjamul/words-zen/api/routes"
"github.com/gin-gonic/gin"
)
//go:embed views/*
var viewsFs embed.FS
func main() {
// Get port from env
port := ":3000"
_, present := os.LookupEnv("PORT")
if present {
port = ":" + os.Getenv("PORT")
}
// Set the router as the default one shipped with Gin
server := gin.Default()
// Initialize the routes
routes.ViewsFs = viewsFs
routes.InitRoutes(server)
// Start and run the server
log.Fatal(server.Run(port))
}