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

Home Page:https://react-saas.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Defining api route

ogdabou opened this issue Β· comments

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 πŸ™‡ .
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 ?

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.