orpc-file-based-router 0.0.4 → 0.0.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 +15 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A plugin for [oRPC](https://orpc.unnoq.com) that automatically creates an oRPC router configuration based on your file structure.
|
|
4
4
|
|
|
5
|
+
> ⚠️ **IMPORTANT:** Works only at nodejs runtime
|
|
6
|
+
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
9
|
```bash
|
|
@@ -13,6 +15,7 @@ yarn add orpc-file-based-router
|
|
|
13
15
|
## Usage
|
|
14
16
|
|
|
15
17
|
```typescript
|
|
18
|
+
import { RPCHandler } from '@orpc/server/node'
|
|
16
19
|
import { generateRouter } from 'orpc-file-based-router'
|
|
17
20
|
|
|
18
21
|
const routesDir = new URL('./routes', import.meta.url).pathname
|
|
@@ -27,20 +30,20 @@ const handler = new RPCHandler(router)
|
|
|
27
30
|
```
|
|
28
31
|
src/routes
|
|
29
32
|
├── auth
|
|
30
|
-
│ ├── me.ts
|
|
31
|
-
│ ├── signin.ts
|
|
32
|
-
│ └── signup.ts
|
|
33
|
+
│ ├── me.ts
|
|
34
|
+
│ ├── signin.ts
|
|
35
|
+
│ └── signup.ts
|
|
33
36
|
│
|
|
34
37
|
├── planets
|
|
35
38
|
│ ├── {id}
|
|
36
|
-
│ │ ├── find.ts
|
|
37
|
-
│ │ └── update.ts
|
|
39
|
+
│ │ ├── find.ts
|
|
40
|
+
│ │ └── update.ts
|
|
38
41
|
│ │
|
|
39
|
-
│ ├── create.ts
|
|
40
|
-
│ ├── index.ts
|
|
41
|
-
│ └── list.ts
|
|
42
|
+
│ ├── create.ts
|
|
43
|
+
│ ├── index.ts
|
|
44
|
+
│ └── list.ts
|
|
42
45
|
│
|
|
43
|
-
└── sse.ts
|
|
46
|
+
└── sse.ts
|
|
44
47
|
```
|
|
45
48
|
|
|
46
49
|
### Generated result
|
|
@@ -73,3 +76,6 @@ export const router = {
|
|
|
73
76
|
}
|
|
74
77
|
```
|
|
75
78
|
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
MIT
|
package/package.json
CHANGED