You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: update installation instructions etc. (#243)
* fix: update installation instructions etc.
The module name has changed, so the installation instructions and sample code needs to be updated to match.
* Update README.md
* chore: update reply-from package name
* chore: update new fastify package names
Co-authored-by: Manuel Spigolon <[email protected]>
@@ -9,8 +9,8 @@ Proxy your HTTP requests to another server, with hooks.
9
9
This [`fastify`](https://www.fastify.io) plugin forwards all requests
10
10
received with a given prefix (or none) to an upstream. All Fastify hooks are still applied.
11
11
12
-
`fastify-http-proxy` is built on top of
13
-
[`fastify-reply-from`](http://npm.im/fastify-reply-from), which enables single route proxying.
12
+
`@fastify/http-proxy` is built on top of
13
+
[`@fastify/reply-from`](http://npm.im/fastify-reply-from), which enables single route proxying.
14
14
15
15
This plugin can be used in a variety of circumstances, for example if you have to proxy an internal domain to an external domain (useful to avoid CORS problems) or to implement your own API gateway for a microservices architecture.
16
16
@@ -21,7 +21,7 @@ Fastify 3.x. See [this branch](https://github.com/fastify/fastify-http-proxy/tre
21
21
## Install
22
22
23
23
```
24
-
npm i fastify-http-proxy fastify
24
+
npm i @fastify/http-proxy fastify
25
25
```
26
26
27
27
## Example
@@ -30,7 +30,7 @@ npm i fastify-http-proxy fastify
30
30
constFastify=require('fastify')
31
31
constserver=Fastify()
32
32
33
-
server.register(require('fastify-http-proxy'), {
33
+
server.register(require('@fastify/http-proxy'), {
34
34
upstream:'http://my-api.example.com',
35
35
prefix:'/api', // optional
36
36
http2:false// optional
@@ -46,7 +46,7 @@ If you want to have different proxies on different prefixes you can register mul
46
46
```js
47
47
constFastify=require('fastify')
48
48
constserver=Fastify()
49
-
constproxy=require('fastify-http-proxy')
49
+
constproxy=require('@fastify/http-proxy')
50
50
51
51
// /api/x will be proxied to http://my-api.example.com/x
52
52
server.register(proxy, {
@@ -74,11 +74,11 @@ For other examples, see [`example.js`](examples/example.js).
74
74
75
75
## Request tracking
76
76
77
-
`fastify-http-proxy` can track and pipe the `request-id` across the upstreams. Using the [`hyperid`](https://www.npmjs.com/package/hyperid) module and the [`fastify-reply-from`](https://github.com/fastify/fastify-reply-from) built-in options a fairly simple example would look like this:
77
+
`@fastify/http-proxy` can track and pipe the `request-id` across the upstreams. Using the [`hyperid`](https://www.npmjs.com/package/hyperid) module and the [`@fastify/reply-from`](https://github.com/fastify/fastify-reply-from) built-in options a fairly simple example would look like this:
78
78
79
79
```js
80
80
constFastify=require('fastify')
81
-
constproxy=require('fastify-http-proxy')
81
+
constproxy=require('@fastify/http-proxy')
82
82
consthyperid=require('hyperid')
83
83
84
84
constserver=Fastify()
@@ -98,7 +98,7 @@ server.listen(3000);
98
98
## Options
99
99
100
100
This `fastify` plugin supports _all_ the options of
101
-
[`fastify-reply-from`](https://github.com/fastify/fastify-reply-from) plus the following.
101
+
[`@fastify/reply-from`](https://github.com/fastify/fastify-reply-from) plus the following.
102
102
103
103
*Note that this plugin is fully encapsulated, and non-JSON payloads will
104
104
be streamed directly to the destination.*
@@ -153,7 +153,7 @@ An array that contains the types of the methods. Default: `['DELETE', 'GET', 'HE
153
153
154
154
This module has _partial_ support for forwarding websockets by passing a
155
155
`websocket` option. All those options are going to be forwarded to
0 commit comments