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