LoginSignup
0
0

Next.js App Router API JavaScript Hello, World!

Posted at

Next.jsのApp Router APIを使ったHello, World!です。

app/api/route.js
import { NextResponse } from 'next/server'
 
export async function GET() {
  return NextResponse.json({ message: 'Hello, World!' })
}

http://localhost:3000/api にアクセスして
次の結果がブラウザに表示されることを期待する。

{"message":"Hello, World!"}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0