Comaptibility between REST and HTTP API

0

Hi, I have been using REST type endpoints with API gateway. APIs are defined in lot of smaller functions/lambda/microservices i.e. user Service

basePath : user

Path : /v1/users

custom domain: mydomain.com

So my API gateway url become : https://mydomain.com/user/v1/users and this works fine.

and recently i tried function/Lamda URLs and via lambda url i can use only APi gwateway V2 request/response, and for that i changed my function/lambda code , But then REST API via API gateway stopped working as i was getting request in V2 format and i was using V1 format.

So to make everything in sync i moved my existing API from REST to HTTP as well which use V2 request

NotwI can call lambda url https://{lambdadomain}/user/v1/users

but my original url via API gateway doesn't work https://mydomain.com/user/v1/users

After digging bit more i found out that now my function code receive url as /v1/users and not /user/v1/users from API gateway

to make it work for now i have to add two mappings in my gin/go application and it works but doesn't look good as i have to add 2 entries for every url

		r.GET("/user/v1/users", user.GetUserHandler) // Works with https://{lambdadomain}/user/v1/users
		r.GET("/v1/users", user.GetUserHandler) // Works with https://mydomain.com/user/v1/users

is this expected behaviour switching from REST to HTTP ? or is it a bug? i couldn't find any documentation for it?

Thanks Ravi

Ravi
已提問 2 年前檢視次數 250 次
沒有答案

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南