2

I'm using GoFiber via lambda for my API, and I don't really see the value in having to hard-code all of the values in the yaml file if I'm going to handle the routing directly in GoFiber. Is that a common use case? I want to use API Gateway to have different API Keys and usage plans and rate-limiting. I can't find any documentation with any examples of API Gateway using GoFiber specifically.

I was hoping just to have a root route in API Gateway that passes everything else through GoFiber to authenticate etc. The only thing API Gateway would do is rate-limit and track usage per API Key.

I would authenticate inside GoFiber and would handle all responses there.

Does anybody have a link to any sort of documentation that would help me figure out a good design pattern for this?

Joel Hager
  • 2,990
  • 3
  • 15
  • 44

1 Answers1

0

Yes, that is the common practice, since AWS official documentation does the same - AWS Lambda Powertools for Python . Here is a Python example, but it is the same for Go.

dsha256
  • 230
  • 1
  • 7
  • To be clear - To route *everything* through a root endpoint is common, or specifying every endpoint manually? Apologies. – Joel Hager May 01 '23 at 23:02
  • Could you explain what `manually` means in this context? Adding a new `lambda` function for each route? @JoelHager – dsha256 May 02 '23 at 19:16
  • Right now the api gateway intercepts everything and passes it to a single go fiber instance. The fiber instance does the routing and validation. I don't want to have to spin up new gateway routes or lambdas. I just didn't know if people generally used that approach. – Joel Hager May 03 '23 at 03:37
  • 1
    Now I got it. You're good, that's absolutely fine. – dsha256 May 04 '23 at 08:53