Skip to content

Commit a9fd24f

Browse files
committed
docs: add h3 usage
1 parent b4707e9 commit a9fd24f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,28 @@ export default defineNuxtConfig({
3434
// GET /api/users -> https://jsonplaceholder.typicode.com/users [304]
3535
```
3636

37+
## Usage with h3
38+
39+
```ts
40+
import { createApp } from 'h3'
41+
import { createProxyMiddleware } from 'nuxt-proxy/middleware'
42+
43+
const app = createApp()
44+
45+
app.use(createProxyMiddleware({
46+
target: 'https://jsonplaceholder.typicode.com',
47+
changeOrigin: true,
48+
pathRewrite: {
49+
'^/api/todos': '/todos',
50+
'^/api/users': '/users'
51+
},
52+
pathFilter: [
53+
'/api/todos',
54+
'/api/users'
55+
]
56+
}))
57+
```
58+
3759
## License
3860

3961
MIT

0 commit comments

Comments
 (0)