orpc-file-based-router 0.0.12 → 0.0.14
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 +11 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,7 +45,7 @@ src/routes
|
|
|
45
45
|
└── sse.ts
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
3. Each file should export
|
|
48
|
+
3. Each file should export an oRPC function
|
|
49
49
|
|
|
50
50
|
4. Simply replace router in your handlers with the result of the `createRouter`
|
|
51
51
|
function:
|
|
@@ -58,7 +58,17 @@ const routesDir = new URL("./routes", import.meta.url).pathname;
|
|
|
58
58
|
const router = await createRouter(routesDir);
|
|
59
59
|
|
|
60
60
|
const handler = new RPCHandler(router);
|
|
61
|
+
|
|
61
62
|
```
|
|
63
|
+
> **Note:** If your environment doesn't support top-level await, wrap your server startup code in an async function:
|
|
64
|
+
> ```typescript
|
|
65
|
+
> async function startServer() {
|
|
66
|
+
> const router = await createRouter(routesDir);
|
|
67
|
+
> const handler = new RPCHandler(router);
|
|
68
|
+
> // ... start your server
|
|
69
|
+
> }
|
|
70
|
+
> startServer();
|
|
71
|
+
> ```
|
|
62
72
|
|
|
63
73
|
## How to generate configuration file
|
|
64
74
|
|
package/package.json
CHANGED