ixartz / SaaS-Boilerplate

🚀🎉📚 SaaS Boilerplate built with Next.js + Tailwind CSS + Shadcn UI + TypeScript. ⚡️ Full-stack React application with Auth, Multi-tenancy, Roles & Permissions, i18n, Landing Page, DB, Logging, Testing
https://react-saas.com/
MIT License
4.08k stars 571 forks source link

Defining api route #12

Closed ogdabou closed 6 months ago

ogdabou commented 6 months ago

Hello ! Thanks for this repository !

I'm trying to define simple api routes but get 404 errors.

I'm new to nextJs so sorry if that's a lack a knowledge :bow: . To my understanding here is used NextJS 14 and AppRouter, but within the src/app directory.

I tried doing this: src/app/hello/route.ts

export async function GET() {
  return Response.json({
    message: 'Hello !'
  })
}

But got 404

curl localhost:3000/hello

Am I getting something wrong ?

ixartz commented 6 months ago

The project implements i18n, you need to place the new route under src/app/[locale]/hello/route.

FYI, this question is very specific to the project/template/boilerplate, it's the right place to ask your question. But, if it's a general question about Next.js, please use the official repository.