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

Keine Antworten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen