api
Answered
Sloth bear posted this in #help-forum
Sloth bearOP
I'm not sure why my API file isn't working. I've been trying to call it using Insomnia, but I'm receiving a 404 response.
18 Replies
don't do that
just remove default
Answer
Sloth bearOP
Oh okay thank you @Anay-208, just one more question if you don't mind 😅
Just ask atp
Sloth bearOP
Let's assume I have two different files inside my API directory, and I want to call their endpoints. I understand that using the URL http://localhost:3000/api would only access one of them. However, if I have another file, should the correct way to access it be through http://localhost:3000/api/hello?
you'd have to do this
Sloth bearOP
And what if i want to access only hello one?
@Sloth bear And what if i want to access only hello one?
I'm not sure what you mean.
if you create api/hello/route.ts,
it'll be accessible at /api/hello
if you create api/hello/route.ts,
it'll be accessible at /api/hello
I recommend you to read through this: https://nextjs.org/docs/app/building-your-application/routing
@Anay-208 just remove default
@Sloth bear mark this message as a solution
Thank you very much ðŸ™
np, feel free to ping me in any other help forum whenever you need help
Sloth bearOP
I will add you as friend so i don't forget your name if you don't mind
@Sloth bear I will add you as friend so i don't forget your name if you don't mind
You can just DM me once. You can find my name easily by scrolling