Add in a few middlewares I need.

main
Zed A. Shaw 3 weeks ago
parent 8c04bffa5d
commit 81aaffec56
  1. 2
      go.mod
  2. 8
      main.go

@ -9,7 +9,6 @@ require (
github.com/gofiber/template/html/v2 v2.1.3
github.com/jmoiron/sqlx v1.4.0
github.com/mattn/go-sqlite3 v1.14.28
github.com/valyala/quicktemplate v1.8.0
)
require (
@ -82,6 +81,7 @@ require (
github.com/tursodatabase/libsql-client-go v0.0.0-20240902231107-85af5b9d094d // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.58.0 // indirect
github.com/valyala/quicktemplate v1.8.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect
github.com/vertica/vertica-sql-go v1.3.3 // indirect
github.com/ydb-platform/ydb-go-genproto v0.0.0-20241112172322-ea1f63298f77 // indirect

@ -10,6 +10,11 @@ import (
_ "github.com/mattn/go-sqlite3"
"github.com/jmoiron/sqlx"
sq "github.com/Masterminds/squirrel"
"github.com/gofiber/fiber/v2/middleware/recover"
"github.com/gofiber/fiber/v2/middleware/encryptcookie"
"github.com/gofiber/fiber/v2/middleware/session"
"github.com/gofiber/fiber/v2/middleware/helmet"
"github.com/gofiber/fiber/v2/middleware/basicauth"
)
type Link struct {
@ -34,11 +39,14 @@ func main() {
log.Fatalln(err)
}
store := session.New()
engine := html.New("./views", ".html")
app := fiber.New(fiber.Config{
Views: engine,
})
app.Use(logger.New())
app.Use(recover.New())
// handler that returns one json from a sql database
app.Get("/api/stream/", func (c *fiber.Ctx) error {

Loading…
Cancel
Save