Next.js Discord

Discord Forum

Folder structure

Unanswered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
I have an exressjs backend and I want to make fecth request from my nextjs 15 frontend where should I make the fetch requests ? from lib/api/user.ts ? or somewhere else, what the best practice ?

2 Replies

If you wanna fetch directly to the express backend you should just fetch on the client side. If you want to use the backend of the nextjs project as an intermidiary step to obfuscate the end points then you should do it in src/app/api/blah.ts
Transvaal lionOP
ok great thank you !