genofire/hs_monolith
genofire
/
hs_monolith
Archived
1
0
Fork 0
This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
hs_monolith/http/bindapi.go

21 lines
868 B
Go

// Package that contains all api routes of this microservice
package http
import (
goji "goji.io"
"goji.io/pat"
"github.com/genofire/hs_master-kss-monolith/lib/http"
"github.com/genofire/hs_master-kss-monolith/runtime"
)
// Function to bind all api routes to the webserver
func BindAPI(router *goji.Mux) {
router.HandleFunc(pat.Get("/api/status"), status)
router.HandleFunc(pat.Get("/api/good/:productid"), listGoods)
router.HandleFunc(pat.Get("/api/good/availablity/:productid"), getGoodAvailability)
router.HandleFunc(pat.Get("/api/good/freshness/:goodid"), getGoodFreshness)
router.HandleFunc(pat.Post("/api/good/:productid"), http.PermissionHandler(addGood, runtime.HasPermission, runtime.PermissionCreateGood))
router.HandleFunc(pat.Delete("/api/good/:goodid"), http.PermissionHandler(delGood, runtime.HasPermission, runtime.PermissionDeleteGood))
}