@alevnyacow/nzmt 0.8.5 → 0.8.6
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/README.md +16 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,6 +37,22 @@ npx nzmt service product i:ProductStore
|
|
|
37
37
|
npx nzmt controller shop i:Logger,ProductService
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
The entire structure and infrastructure have been generated. All that remains is developing the contracts and the logic. The organization and content of the generated files are clear, and they’re easy to understand.
|
|
41
|
+
|
|
42
|
+
You can use `fromDI` method anywhere you need an instance of a controller or a service:
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
// app/api/shop/route.ts
|
|
46
|
+
|
|
47
|
+
import { ShopController } from "@/server/controllers/shop"
|
|
48
|
+
import { fromDI } from "@/server/di"
|
|
49
|
+
|
|
50
|
+
const controller = fromDI<ShopController>('ShopController')
|
|
51
|
+
|
|
52
|
+
// Suppose you have implemented the list_GET method in the controller.
|
|
53
|
+
export const GET = controller.list_GET
|
|
54
|
+
```
|
|
55
|
+
|
|
40
56
|
# Design principles
|
|
41
57
|
|
|
42
58
|
## Core idea
|