cml04-falcon-system/handset/handlers/barcode.go

18 lines
468 B
Go
Raw Normal View History

2024-10-01 20:28:58 +02:00
package handlers
import (
"net/http"
2024-10-02 13:40:27 +02:00
"git.espin.casa/albert/cml04-falcon-system/internal/publisher"
2024-10-01 20:28:58 +02:00
"github.com/julienschmidt/httprouter"
)
2024-10-02 10:36:08 +02:00
func BarCodeHandler(publisher publisher.Publisher) httprouter.Handle {
2024-10-01 20:28:58 +02:00
return func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
barcode := ps.ByName("barcode")
2024-10-02 13:40:27 +02:00
if err := publisher.NewBarcode(r.Context(), barcode); err != nil {
2024-10-01 20:28:58 +02:00
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}
}