Next.js Discord

Discord Forum

api

Answered
Sloth bear posted this in #help-forum
Open in Discord
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.
Answered by Anay-208
just remove default
View full answer

18 Replies

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?
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
@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