This repository was archived by the owner on Dec 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
57 lines (43 loc) · 1.3 KB
/
main.go
File metadata and controls
57 lines (43 loc) · 1.3 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package main
import (
"os"
"fmt"
"log"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
)
// @title Beta API
// @version 1.0
// @description The Beta FireAcademy.io API
// @termsOfService https://fireacademy.io/terms-and-conditions.txt
// @contact.name yakuhito
// @contact.url https://twitter.com/yakuh1t0
// @contact.email y@kuhi.to
// @license.name MIT
// @license.url https://github.com/FireAcademy/beta/blob/master/LICENSE
// @host kraken.fireacademy.io
// @BasePath /beta
// @securityDefinitions.apikey ApiKeyAuth
// @in header
// @name X-API-Key
// @description The API key can also be included in the URL or as a GET parameter - please see [https://docs.fireacademy.io/developers/using-api-keys](https://docs.fireacademy.io/developers/using-api-keys) for more details.
func getPort() string {
port := os.Getenv("BETA_LISTEN_PORT")
if port == "" {
port = "1337"
}
return port
}
func main() {
app := fiber.New()
port := getPort()
app.Use(cors.New())
app.Get("/", func(c *fiber.Ctx) error {
return c.SendString("Beta is running.")
})
SetupDB()
SetupSyncAPIRoutes(app)
SetupSingletonStatesAPIRoutes(app)
SetupPuzzleAPIRoutes(app)
log.Fatalln(app.Listen(fmt.Sprintf(":%v", port)))
}