You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
578 B
28 lines
578 B
package features_shopping
|
|
|
|
import (
|
|
"github.com/gofiber/fiber/v2"
|
|
"MY/webapp/data"
|
|
_ "github.com/mattn/go-sqlite3"
|
|
sq "github.com/Masterminds/squirrel"
|
|
"fmt"
|
|
)
|
|
|
|
func GetApiProducts(c *fiber.Ctx) error {
|
|
sql, args, err := sq.Select("*").From("Product").ToSql()
|
|
|
|
fmt.Println("SQL:", sql, args, err)
|
|
|
|
return data.SelectJson[data.Product](c, err, sql, args...)
|
|
}
|
|
|
|
|
|
func GetApiCart(c *fiber.Ctx) error {
|
|
|
|
return c.JSON(fiber.Map{})
|
|
}
|
|
|
|
func SetupApi(app *fiber.App) {
|
|
app.Get("/api/shopping/products", GetApiProducts)
|
|
app.Get("/api/shopping/cart", GetApiCart)
|
|
}
|
|
|