You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi guys - question... Ive built a next JS react app with a ton of front end functionality, and ive jsut finished creating an API folder to be used for serverless functions.
I need the API to reference similar material in the lib that the front end accesses as well. When i make an API request, it works swimmingly up until the point that it hits a routing rule, as in, THIS part:
So essentially, Im re-routing to another route in the api folder, but I get errors saying this:
I have tested by putting in my actual website in before the and it seems to work. BUT, id like to avoid this as best practice, as Im pretty sure ther ehas got to be a better way than hard coding my website in beofre that (wouldnt really go over well for a git)--- I could try a dynamic variable from my environemnt, but im pretty sure there is a better way still.
What is best practice here for an API request to route anywhere within the app? thanks!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Question
Hi guys - question... Ive built a next JS react app with a ton of front end functionality, and ive jsut finished creating an API folder to be used for serverless functions.
I need the API to reference similar material in the lib that the front end accesses as well. When i make an API request, it works swimmingly up until the point that it hits a routing rule, as in, THIS part:
So essentially, Im re-routing to another route in the api folder, but I get errors saying this:
I have tested by putting in my actual website in before the and it seems to work. BUT, id like to avoid this as best practice, as Im pretty sure ther ehas got to be a better way than hard coding my website in beofre that (wouldnt really go over well for a git)--- I could try a dynamic variable from my environemnt, but im pretty sure there is a better way still.
What is best practice here for an API request to route anywhere within the app? thanks!
Beta Was this translation helpful? Give feedback.
All reactions