Skip to content

Commit dd7090c

Browse files
committed
Add a POST route
1 parent f41276c commit dd7090c

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

examples/api/app/api/hello/route.js renamed to examples/api/app/api/hello/route.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ export async function GET() {
66
const sayHi = !!headersList.get("should-say-hi");
77
return new Response(sayHi ? "Hi World!" : "Hello World!");
88
}
9+
10+
export async function POST(request: Request) {
11+
return new Response(`Hello post-World! body=${await request.text()}`);
12+
}

examples/api/tsconfig.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"compilerOptions": {
3+
"lib": ["dom", "dom.iterable", "esnext"],
4+
"allowJs": true,
5+
"skipLibCheck": true,
6+
"strict": false,
7+
"noEmit": true,
8+
"incremental": true,
9+
"module": "esnext",
10+
"esModuleInterop": true,
11+
"moduleResolution": "node",
12+
"resolveJsonModule": true,
13+
"isolatedModules": true,
14+
"jsx": "preserve",
15+
"plugins": [
16+
{
17+
"name": "next"
18+
}
19+
]
20+
},
21+
"include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"],
22+
"exclude": ["node_modules"]
23+
}

0 commit comments

Comments
 (0)