:wave: I can just use `NextjsSite` construct to de...
# help
k
👋 I can just use
NextjsSite
construct to deploy my site and use nextjs
/api
route for lambda endpoints right? What's the pros/coins instead of using sst
Api
construct?
f
I will let other who are more familiar with Next.js to chime me, but imo: • NextjsSite’s API runs in Edge Lambdas. Edge Lambda have limitations, ie. environment variables cannot be used. • If u later decide to move ur Next.js app to ECS or off AWS, you’d need to figure out a way to grant IAM permissions for the APIs if they make calls to other AWS services.
k
@Frank thanks for reply! I look forward for more insights.
d
Essentially the answer is "every feature of API gateway". Next.is API routes essentially have no features besides a URL. This may not matter, but things like authorizers end up being helpful in all but the smallest apps.
k
@Derek Kershner 👋 thanks for reply. Could you explain a bit more these things: • Next.is API routes essentially have no features besides a URL • authorizers end up being helpful in all but the smallest apps
d
Its a comparison of the most lightweight, featureless API, and one of the most feature-driven API services, so the advantages/disadvantages match that. Next.js API routes do nothing, they just handle a request, end of story. API Gateway on the other hand has bells and whistles galore, from Throttling, to CORS, to Authorizers. That last one is likely the most useful: Controlling access to HTTP APIs with JWT authorizers - Amazon API Gateway
k
@Derek Kershner thanks for the clarification 🙌🏻