Skip to content

Commit b517597

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

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-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: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"compilerOptions": {
3+
"lib": [
4+
"dom",
5+
"dom.iterable",
6+
"esnext"
7+
],
8+
"allowJs": true,
9+
"skipLibCheck": true,
10+
"strict": false,
11+
"noEmit": true,
12+
"incremental": true,
13+
"module": "esnext",
14+
"esModuleInterop": true,
15+
"moduleResolution": "node",
16+
"resolveJsonModule": true,
17+
"isolatedModules": true,
18+
"jsx": "preserve",
19+
"plugins": [
20+
{
21+
"name": "next"
22+
}
23+
]
24+
},
25+
"include": [
26+
"next-env.d.ts",
27+
".next/types/**/*.ts",
28+
"**/*.ts",
29+
"**/*.tsx"
30+
],
31+
"exclude": [
32+
"node_modules"
33+
]
34+
}

0 commit comments

Comments
 (0)