-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.go
41 lines (36 loc) · 949 Bytes
/
routes.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
40
41
package views
import (
"github.com/gofiber/fiber/v2"
"github.com/horkruxes/hkxserver/service"
)
func SetupLocalRoutes(s service.Service, app *fiber.App) {
app.Get("/ping", pong)
if s.ClientConfig.Enabled {
// Main view with "Filters"
app.Get("/", GetMain(s))
app.Post("/", GetMain(s)) // Select pods by applying filter. Changes the url that Get will parse
app.Get("/user/:pubKey", GetAuthor(s))
app.Get("/comments/:uuid", GetComments(s))
app.Post("/new", NewMessage(s))
// Keys
app.Get("/keys", GetKeys)
app.Post("/keys", PostKeys)
// FAQ
app.Get("/faq", GetFaq)
app.Get("/404", page404)
app.Get("/offline", offline)
} else {
app.Get("/", GetMainNoFront)
}
}
// Healthcheck
func pong(c *fiber.Ctx) error {
return c.SendString("pong")
}
func page404(c *fiber.Ctx) error {
return c.SendString("404: wrong url")
}
// Offline is used for PWAs
func offline(c *fiber.Ctx) error {
return c.SendString("offline")
}