-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (31 loc) · 838 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
38
39
package main
import (
"os"
"github.com/codersidprogrammer/gonotif/cmd"
"github.com/codersidprogrammer/gonotif/pkg/middleware"
"github.com/codersidprogrammer/gonotif/pkg/utils"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/logger"
)
func main() {
// Bootstraping configuration
cmd.Bootstrap()
// Configure fiber apps
app := fiber.New(fiber.Config{
ServerHeader: "Notification Server",
AppName: "Go Notif",
EnablePrintRoutes: false,
Prefork: false,
})
// Middleware
f, err := os.OpenFile("./request.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
utils.ExitIfErr(err, "Couldn't open log file")
app.Use(logger.New(logger.Config{
Output: f,
}))
app.Use("/ws", middleware.UseWebsocketHandler)
// Defining routes
cmd.Route(app)
// Run!
cmd.RunServer(app)
}