Skip to content

Commit d8cac53

Browse files
TrottEomm
andauthored
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]>
1 parent 6ea0598 commit d8cac53

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# fastify-http-proxy
1+
# @fastify/http-proxy
22

33
![CI](https://github.com/fastify/fastify-http-proxy/workflows/CI/badge.svg)
44
[![NPM version](https://img.shields.io/npm/v/fastify-http-proxy.svg?style=flat)](https://www.npmjs.com/package/fastify-http-proxy)
@@ -9,8 +9,8 @@ Proxy your HTTP requests to another server, with hooks.
99
This [`fastify`](https://www.fastify.io) plugin forwards all requests
1010
received with a given prefix (or none) to an upstream. All Fastify hooks are still applied.
1111

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.
1414

1515
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.
1616

@@ -21,7 +21,7 @@ Fastify 3.x. See [this branch](https://github.com/fastify/fastify-http-proxy/tre
2121
## Install
2222

2323
```
24-
npm i fastify-http-proxy fastify
24+
npm i @fastify/http-proxy fastify
2525
```
2626

2727
## Example
@@ -30,7 +30,7 @@ npm i fastify-http-proxy fastify
3030
const Fastify = require('fastify')
3131
const server = Fastify()
3232

33-
server.register(require('fastify-http-proxy'), {
33+
server.register(require('@fastify/http-proxy'), {
3434
upstream: 'http://my-api.example.com',
3535
prefix: '/api', // optional
3636
http2: false // optional
@@ -46,7 +46,7 @@ If you want to have different proxies on different prefixes you can register mul
4646
```js
4747
const Fastify = require('fastify')
4848
const server = Fastify()
49-
const proxy = require('fastify-http-proxy')
49+
const proxy = require('@fastify/http-proxy')
5050

5151
// /api/x will be proxied to http://my-api.example.com/x
5252
server.register(proxy, {
@@ -74,11 +74,11 @@ For other examples, see [`example.js`](examples/example.js).
7474

7575
## Request tracking
7676

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:
7878

7979
```js
8080
const Fastify = require('fastify')
81-
const proxy = require('fastify-http-proxy')
81+
const proxy = require('@fastify/http-proxy')
8282
const hyperid = require('hyperid')
8383

8484
const server = Fastify()
@@ -98,7 +98,7 @@ server.listen(3000);
9898
## Options
9999

100100
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.
102102

103103
*Note that this plugin is fully encapsulated, and non-JSON payloads will
104104
be streamed directly to the destination.*
@@ -153,7 +153,7 @@ An array that contains the types of the methods. Default: `['DELETE', 'GET', 'HE
153153

154154
This module has _partial_ support for forwarding websockets by passing a
155155
`websocket` option. All those options are going to be forwarded to
156-
[`fastify-websocket`](https://github.com/fastify/fastify-websocket).
156+
[`@fastify/websocket`](https://github.com/fastify/fastify-websocket).
157157
A few things are missing:
158158

159159
1. forwarding headers as well as `rewriteHeaders`
@@ -171,7 +171,7 @@ The following benchmarks where generated on a dedicated server with an Intel(R)
171171
| :----------------- | :------------------------- |
172172
| `express-http-proxy` | 2557 |
173173
| `http-proxy` | 9519 |
174-
| `fastify-http-proxy` | 15919 |
174+
| `@fastify/http-proxy` | 15919 |
175175

176176
The results were gathered on the second run of `autocannon -c 100 -d 5
177177
URL`.

0 commit comments

Comments
 (0)