feat(barcodes): Baseline for implementation

This commit is contained in:
Nicolai Ort 2024-12-12 16:30:46 +01:00
parent 8f676f08a9
commit 5587fdaaa8
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F
2 changed files with 19 additions and 3 deletions

18
handlers/barcode.go Normal file
View File

@ -0,0 +1,18 @@
package handlers
import (
"github.com/gofiber/fiber/v2"
)
// GenerateBarcode godoc
// @Summary Generate barcodes
// @Description Generate barcodes based on the provided data
// @Tags barcodes
// @Param type path string true "Barcode type" Enums(ean13, code128)
// @Param content path string true "Barcode content" MinLength(1)
// @Produce image/png
// @Router /v1/barcodes/{type}/{content} [get]
func (h *DefaultHandler) GenerateBarcode(c *fiber.Ctx) error {
c.Set(fiber.HeaderContentType, "text/plain")
return c.Send([]byte("Hello, World!"))
}

View File

@ -97,9 +97,7 @@ func main() {
pdfv1.Post("/cards", handler.GenerateCard) pdfv1.Post("/cards", handler.GenerateCard)
pdfv1.Post("/certificates", handler.GenerateCertificate) pdfv1.Post("/certificates", handler.GenerateCertificate)
barcodev1 := v1.Group("/barcodes") v1.Get("/barcodes/:type/:content", handler.GenerateBarcode)
barcodev1.Get("/:type/:content", handler.GenerateBarcode)
app.Use(handler.NotFoundHandler) app.Use(handler.NotFoundHandler)
docs.SwaggerInfo.BasePath = "/" docs.SwaggerInfo.BasePath = "/"