add store service
This commit is contained in:
23
services/store/store.go
Normal file
23
services/store/store.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"astra-api-gateway/config"
|
||||
"astra-api-gateway/pkg/api"
|
||||
"github.com/labstack/echo/v4"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func GetFileFromStore(c echo.Context) error {
|
||||
fileName := strings.ReplaceAll(c.Request().RequestURI, "/store", "")
|
||||
|
||||
data, err, req := api.GetRequest(
|
||||
config.Env.MSHosts.StoreHost+fileName,
|
||||
c.Request().Header,
|
||||
)
|
||||
if err != nil {
|
||||
return c.NoContent(http.StatusBadGateway)
|
||||
}
|
||||
|
||||
return c.Blob(req.StatusCode, req.Header.Get("Content-Type"), data)
|
||||
}
|
||||
Reference in New Issue
Block a user