orpc-file-based-router 0.0.14 → 0.0.15
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 +8 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,7 +14,9 @@ structure, similar to Next.js, express-file-routing
|
|
|
14
14
|
> ⚠️ **IMPORTANT:** At this time, the plugin's functionality is only guaranteed
|
|
15
15
|
> in nodejs runtime
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Quickstart
|
|
18
|
+
|
|
19
|
+
0. If you're new to oRPC, read the [oRPC documentation](https://orpc.unnoq.com). Install and configure a basic oRPC server
|
|
18
20
|
|
|
19
21
|
1. Install package
|
|
20
22
|
|
|
@@ -70,9 +72,11 @@ const handler = new RPCHandler(router);
|
|
|
70
72
|
> startServer();
|
|
71
73
|
> ```
|
|
72
74
|
|
|
73
|
-
##
|
|
75
|
+
## Type-Safe Client Configuration (Optional)
|
|
76
|
+
|
|
77
|
+
If you plan to use [oRPC client](https://orpc.unnoq.com/docs/client/client-side), you can set up automatic configuration generation, which can be used for client typing.
|
|
74
78
|
|
|
75
|
-
1.
|
|
79
|
+
1. Add the following code to your main server file (e.g., `server.ts` or `main.ts`). This will automatically regenerate the router configuration each time your server starts:
|
|
76
80
|
|
|
77
81
|
```typescript
|
|
78
82
|
import { generateRouter } from "orpc-file-based-router";
|
|
@@ -82,7 +86,7 @@ const outputFile = new URL("./router.ts", import.meta.url).pathname;
|
|
|
82
86
|
generateRouter(routesDir, outputFile);
|
|
83
87
|
```
|
|
84
88
|
|
|
85
|
-
2. Generated
|
|
89
|
+
2. Generated router is ready to use in client:
|
|
86
90
|
|
|
87
91
|
```typescript
|
|
88
92
|
// router.ts
|
package/package.json
CHANGED