core-nails 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -82,22 +82,27 @@ export async function POST(req: Request) {
|
|
|
82
82
|
// --- 6️⃣ API [id]/route.ts ---
|
|
83
83
|
fs.mkdirSync(apiIdDir, { recursive: true });
|
|
84
84
|
const apiIdRoutePath = path.join(apiIdDir, "route.ts");
|
|
85
|
-
const apiIdRouteContent = `import
|
|
85
|
+
const apiIdRouteContent = `import { NextRequest } from "next/server";
|
|
86
|
+
import ${camelName}Controller from "@controller/${camelName}";
|
|
86
87
|
|
|
87
|
-
export async function GET(req:
|
|
88
|
-
|
|
88
|
+
export async function GET(req: NextRequest, context: { params: Promise<{ id: string }> }): Promise<Response> {
|
|
89
|
+
const { id } = await context.params;
|
|
90
|
+
return ${camelName}Controller.show_action(req, id);
|
|
89
91
|
}
|
|
90
92
|
|
|
91
|
-
export async function PATCH(req:
|
|
92
|
-
|
|
93
|
+
export async function PATCH(req: NextRequest, context: { params: Promise<{ id: string }> }): Promise<Response> {
|
|
94
|
+
const { id } = await context.params;
|
|
95
|
+
return ${camelName}Controller.update_action(req, id);
|
|
93
96
|
}
|
|
94
97
|
|
|
95
|
-
export async function PUT(req:
|
|
96
|
-
|
|
98
|
+
export async function PUT(req: NextRequest, context: { params: Promise<{ id: string }> }): Promise<Response> {
|
|
99
|
+
const { id } = await context.params;
|
|
100
|
+
return ${camelName}Controller.update_action(req, id);
|
|
97
101
|
}
|
|
98
102
|
|
|
99
|
-
export async function DELETE(req:
|
|
100
|
-
|
|
103
|
+
export async function DELETE(req: NextRequest, context: { params: Promise<{ id: string }> }): Promise<Response> {
|
|
104
|
+
const { id } = await context.params;
|
|
105
|
+
return ${camelName}Controller.destroy_action(req, id);
|
|
101
106
|
}
|
|
102
107
|
`;
|
|
103
108
|
fs.writeFileSync(apiIdRoutePath, apiIdRouteContent);
|
package/package.json
CHANGED
|
@@ -110,22 +110,27 @@ export async function POST(req: Request) {
|
|
|
110
110
|
|
|
111
111
|
const apiIdRoutePath = path.join(apiIdDir, "route.ts");
|
|
112
112
|
|
|
113
|
-
const apiIdRouteContent = `import
|
|
113
|
+
const apiIdRouteContent = `import { NextRequest } from "next/server";
|
|
114
|
+
import ${camelName}Controller from "@controller/${camelName}";
|
|
114
115
|
|
|
115
|
-
export async function GET(req:
|
|
116
|
-
|
|
116
|
+
export async function GET(req: NextRequest, context: { params: Promise<{ id: string }> }): Promise<Response> {
|
|
117
|
+
const { id } = await context.params;
|
|
118
|
+
return ${camelName}Controller.show_action(req, id);
|
|
117
119
|
}
|
|
118
120
|
|
|
119
|
-
export async function PATCH(req:
|
|
120
|
-
|
|
121
|
+
export async function PATCH(req: NextRequest, context: { params: Promise<{ id: string }> }): Promise<Response> {
|
|
122
|
+
const { id } = await context.params;
|
|
123
|
+
return ${camelName}Controller.update_action(req, id);
|
|
121
124
|
}
|
|
122
125
|
|
|
123
|
-
export async function PUT(req:
|
|
124
|
-
|
|
126
|
+
export async function PUT(req: NextRequest, context: { params: Promise<{ id: string }> }): Promise<Response> {
|
|
127
|
+
const { id } = await context.params;
|
|
128
|
+
return ${camelName}Controller.update_action(req, id);
|
|
125
129
|
}
|
|
126
130
|
|
|
127
|
-
export async function DELETE(req:
|
|
128
|
-
|
|
131
|
+
export async function DELETE(req: NextRequest, context: { params: Promise<{ id: string }> }): Promise<Response> {
|
|
132
|
+
const { id } = await context.params;
|
|
133
|
+
return ${camelName}Controller.destroy_action(req, id);
|
|
129
134
|
}
|
|
130
135
|
`;
|
|
131
136
|
|