Refactoring

This commit is contained in:
2023-01-12 21:10:23 +01:00
parent d93fc37943
commit 658cb64a02
7 changed files with 30 additions and 14 deletions

View File

@@ -31,11 +31,12 @@ func RunBlocking(ctx context.Context) {
app := fiber.New()
app.Use(cors.New())
app.Use("/", filesystem.New(filesystem.Config{
Root: http.FS(fe),
}))
// RPC handlers
// websocket
app.Get("/ws-rpc", websocket.New(func(c *websocket.Conn) {
for {
mtype, reader, err := c.NextReader()
@@ -51,7 +52,7 @@ func RunBlocking(ctx context.Context) {
io.Copy(writer, res)
}
}))
// http-post
app.Post("/http-rpc", func(c *fiber.Ctx) error {
reader := c.Context().RequestBodyStream()
writer := c.Response().BodyWriter()