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
Copy file name to clipboardExpand all lines: README.md
+12-10Lines changed: 12 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -22,21 +22,23 @@ var proxy = proxyMiddleware('/api', {target: 'http://www.example.org'});
22
22
// context options
23
23
24
24
// 'proxy' is now ready to be used in a server.
25
-
26
-
// shorthand syntax for the example above:
27
-
// proxyMiddleware('http://www.example.org/api');
28
-
29
25
```
30
26
***context**: matches provided context against request-urls' path.
31
27
Matching requests will be proxied to the target host.
32
28
Example: `'/api'` or `['/api', '/ajax']`. (more about [context matching](#context-matching))
33
29
***options.target**: target host to proxy to.
34
30
Check out available [proxy middleware options](#options).
35
31
32
+
```javascript
33
+
// shorthand syntax for the example above:
34
+
var proxy =proxyMiddleware('http://www.example.org/api');
35
+
36
+
```
37
+
More about the [shorthand configuration](#shorthand).
36
38
37
39
38
40
### Example
39
-
A simple example with express server.
41
+
An example with express server.
40
42
```javascript
41
43
// include dependencies
42
44
var express =require('express');
@@ -97,7 +99,7 @@ Request URL's [ _path-absolute_ and _query_](https://tools.ietf.org/html/rfc3986
97
99
98
100
99
101
### Shorthand
100
-
Use the shorthand syntax for simple use cases. The `context` and `option.target` will be automatically configured when shorthand is used. Options can still be used if needed.
102
+
Use the shorthand syntax when verbose configuration is not needed. The `context` and `option.target` will be automatically configured when shorthand is used. Options can still be used if needed.
@@ -147,7 +149,7 @@ var server = app.listen(3000);
147
149
}
148
150
```
149
151
150
-
***option.proxyTable**: object, re-target `option.target` based on the request header `host` parameter. `host` can be used in conjunction with`path`. The order of the configuration matters.
152
+
***option.proxyTable**: object, re-target `option.target` based on the request header `host` parameter. `host` can be used in conjunction with`path`. Only one instance of the proxy will be used. The order of the configuration matters.
151
153
```javascript
152
154
{
153
155
"integration.localhost:3000" : "http://localhost:8001", // host only
0 commit comments