Next.js Discord

Discord Forum

Recieve NextRequest Type Outside of Nextjs API

Unanswered
Belgian Hare posted this in #help-forum
Open in Discord
Belgian HareOP
Hello, i like the NextRequest type that is used with requests made to an api route inside a nextjs app.

I have a small node.js lambda function running on AWS that i would like to receive NextRequest type requests too.

it seems Next doesnt define the NextRequest on the client before sending request (via fetch or axios for example), its my guess that the req type is created by transforming a typical request format at the server side. This happens when received by next server but before sent to the respect api route function.

Is it possible to create a NextRequest type request outside of the NextJs environment but inside another Nodejs enviroment?

This would help me create a standardized way of handling any requests from my next frontend, in different environments.

0 Replies