forked from Adictya/Agora-Cloud-Recording-Example
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
37 lines (27 loc) · 678 Bytes
/
main.go
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
33
34
35
36
37
package main
import (
"fmt"
"log"
"github.com/gofiber/fiber/v2/middleware/cors"
"github.com/adictya/Agora-Cloud-Recording-Example/api"
"github.com/gofiber/fiber/v2"
"github.com/spf13/viper"
)
func healthCheck(c *fiber.Ctx) error {
return c.SendString("OK")
}
func main() {
// Set global configuration
viper.SetConfigName("config.json")
viper.SetConfigType("json")
viper.AddConfigPath(".")
if err := viper.ReadInConfig(); err != nil {
log.Panicln(fmt.Errorf("fatal error config file: %s", err))
}
viper.AutomaticEnv()
app := fiber.New()
app.Use(cors.New())
app.Get("/", healthCheck)
api.MountRoutes(app)
app.Listen(":" + viper.GetString("PORT"))
}