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.