29 lines
534 B
Go
29 lines
534 B
Go
package web
|
|
|
|
import (
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
func Serve() error {
|
|
engine := ViewsEngine()
|
|
app := fiber.New(fiber.Config{Views: engine})
|
|
|
|
app.Get("/", func(c *fiber.Ctx) error {
|
|
return c.Render("views/index", fiber.Map{}, "views/layouts/main")
|
|
})
|
|
|
|
app.Get("/download", func(c *fiber.Ctx) error {
|
|
url := c.Get("url")
|
|
|
|
return c.Render("views/download", fiber.Map{
|
|
"Url": url,
|
|
}, "views/layouts/main")
|
|
})
|
|
|
|
app.Get("/download/stream", func(c *fiber.Ctx) error {
|
|
return nil
|
|
})
|
|
|
|
return app.Listen(":8080")
|
|
}
|