How can I replicate the vanilla behavior of NextJS API routing in T3 stack?
I am currently working on a project in which i would like to have my server side requests to an endpoint that is not on my local host using axios and REST. Currently, I am placing my server side requests to the endpoint at
src/pages/api/locations/route.ts
, and the client side consumer at src/pages/fakerequest/index.tsx
. The problem I am facing is a 404 when the client tries to fetch data from my serverside request, I tried consuming this on Postman but i get the same 404 error.
I have read the documentation regarding project structure but I don't understand this particular issue considering my authentication routing works, i hope someone can help me with this please!
Here is the relevant code: https://share.riseup.net/#e6cDhcMxsvDXt6ACyhO0SgI
ibby•13d ago
You're mixing up pages & app router api routing
Pages router:
src/pages/api/locations.ts
-> http://localhost:3000/api/locations
App router:
src/app/api/locations/route.ts
-> http://localhost:3000/api/locations
I
Ivan•10d ago
Hey! thanks for the quick reply! i am a bit confused by your answear:
in which folder do i have to place the code that is going to fetch data from the back end?
in which folder do i have to place the code that is going to display the ui in the web browser with the data i fetched from the backend? Best regards!
21KMembers
View on DiscordWant results from more Discord servers?
More PostsWhat is this app?this works but nope?I'm new to Suspense, this works great but I get the error: Did you forget to use 'await'?
It works,Micro Front End best practicesHello! I recently landed a job within a stack centered around micro front ends (react + node), whichUsing Turso in T3-CreateHi,
I am trying to use Turso for T3. I am using drizzle. The connection .env is slightly different No file route found for slug in deploymentThis issue arose when I started my deployment on Render , which simply read as
No file route found Will server components be refeteched on mutation?If I have a page using the server trpc and then a client component that updates the list, will the sNextjs parallel routing questionsI have this routing setup right,
```bash
{
(main) {
about {}
contact {}
(illustrationsHow can I subscribe to updates in an RSS feed?I want to subscribe to changes on a shopify store’s RSS feed for their products. It seems extremely