Next.js Discord

Discord Forum

Always 404 error when try to connect MongoDB Atlas

Unanswered
Pieter posted this in #help-forum
Open in Discord
Hello, it's a bit demotivating already but I don't know what I have wrong in my project that even any simplest thing to be displayed by api gives me a 404 error. no matter what it would be. And I honestly have no idea anymore why this is happening. I've provided a link to the github:https://github.com/Pi0t3r/SunnyHaven

6 Replies

You are going to need to be more specific than that
Where are you using the api?
I dont think i can see any api router/router handler being used
either move /app/pages to /pages or create a route handler in /app/api/posts/route.ts @Pieter
// /app/api/posts/routes.ts
export function GET(req: Request) {
  return Response.json({message: 'Hello from the /api/posts endpoint!'});
}