@newt-app/templates 0.14.0 → 0.14.2
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.
- package/dist/index.js +9 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9019,19 +9019,17 @@ export async function inject<T>(token: Type<T> | Abstract<T> | string | symbol):
|
|
|
9019
9019
|
var web_todos_route_default = {
|
|
9020
9020
|
filename: "apps/web/app/api/todos/route.ts",
|
|
9021
9021
|
template: `import { NextResponse } from 'next/server';
|
|
9022
|
-
import {
|
|
9022
|
+
import { inject } from '@/lib/nest';
|
|
9023
9023
|
import { TodosService } from '@<%= projectName %>/api';
|
|
9024
9024
|
|
|
9025
9025
|
export async function GET() {
|
|
9026
|
-
const
|
|
9027
|
-
const todos = app.get(TodosService);
|
|
9026
|
+
const todos = await inject(TodosService);
|
|
9028
9027
|
return NextResponse.json(todos.findAll());
|
|
9029
9028
|
}
|
|
9030
9029
|
|
|
9031
9030
|
export async function POST(req: Request) {
|
|
9032
9031
|
const { title } = await req.json();
|
|
9033
|
-
const
|
|
9034
|
-
const todos = app.get(TodosService);
|
|
9032
|
+
const todos = await inject(TodosService);
|
|
9035
9033
|
return NextResponse.json(todos.create(title), { status: 201 });
|
|
9036
9034
|
}`
|
|
9037
9035
|
};
|
|
@@ -9040,13 +9038,12 @@ export async function POST(req: Request) {
|
|
|
9040
9038
|
var web_todos_id_route_default = {
|
|
9041
9039
|
filename: "apps/web/app/api/todos/[id]/route.ts",
|
|
9042
9040
|
template: `import { NextResponse } from 'next/server';
|
|
9043
|
-
import {
|
|
9041
|
+
import { inject } from '@/lib/nest';
|
|
9044
9042
|
import { TodosService } from '@<%= projectName %>/api';
|
|
9045
9043
|
|
|
9046
9044
|
export async function DELETE(_req: Request, { params }: { params: Promise<{ id: string }> }) {
|
|
9047
9045
|
const { id } = await params;
|
|
9048
|
-
const
|
|
9049
|
-
const todos = app.get(TodosService);
|
|
9046
|
+
const todos = await inject(TodosService);
|
|
9050
9047
|
todos.remove(Number(id));
|
|
9051
9048
|
return new NextResponse(null, { status: 204 });
|
|
9052
9049
|
}`
|
|
@@ -9056,13 +9053,12 @@ export async function DELETE(_req: Request, { params }: { params: Promise<{ id:
|
|
|
9056
9053
|
var web_todos_toggle_route_default = {
|
|
9057
9054
|
filename: "apps/web/app/api/todos/[id]/toggle/route.ts",
|
|
9058
9055
|
template: `import { NextResponse } from 'next/server';
|
|
9059
|
-
import {
|
|
9056
|
+
import { inject } from '@/lib/nest';
|
|
9060
9057
|
import { TodosService } from '@<%= projectName %>/api';
|
|
9061
9058
|
|
|
9062
9059
|
export async function PATCH(_req: Request, { params }: { params: Promise<{ id: string }> }) {
|
|
9063
9060
|
const { id } = await params;
|
|
9064
|
-
const
|
|
9065
|
-
const todos = app.get(TodosService);
|
|
9061
|
+
const todos = await inject(TodosService);
|
|
9066
9062
|
return NextResponse.json(todos.toggle(Number(id)));
|
|
9067
9063
|
}`
|
|
9068
9064
|
};
|
|
@@ -9171,12 +9167,11 @@ var web_tsconfig_default = {
|
|
|
9171
9167
|
var web_hello_route_default = {
|
|
9172
9168
|
filename: "apps/web/app/api/hello/route.ts",
|
|
9173
9169
|
template: `import { NextResponse } from 'next/server';
|
|
9174
|
-
import {
|
|
9170
|
+
import { inject } from '@/lib/nest';
|
|
9175
9171
|
import { AppService } from '@<%= projectName %>/api';
|
|
9176
9172
|
|
|
9177
9173
|
export async function GET() {
|
|
9178
|
-
const
|
|
9179
|
-
const appService = ctx.get(AppService);
|
|
9174
|
+
const appService = await inject(AppService);
|
|
9180
9175
|
return NextResponse.json({ message: appService.getHello() });
|
|
9181
9176
|
}`
|
|
9182
9177
|
};
|