File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -500,6 +500,7 @@ View the [recipes](https://github.com/chimurai/http-proxy-middleware/tree/master
500
500
501
501
- [ connect] ( https://www.npmjs.com/package/connect )
502
502
- [ express] ( https://www.npmjs.com/package/express )
503
+ - [ fastify] ( https://www.npmjs.com/package/fastify )
503
504
- [ browser-sync] ( https://www.npmjs.com/package/browser-sync )
504
505
- [ lite-server] ( https://www.npmjs.com/package/lite-server )
505
506
- [ polka] ( https://github.com/lukeed/polka )
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ Missing a server? Feel free to extend this list of examples.
9
9
- [ Browser-Sync] ( #browser-sync )
10
10
- [ Express] ( #express )
11
11
- [ Connect] ( #connect )
12
+ - [ fastify] ( #fastify )
12
13
- [ lite-server] ( #lite-server )
13
14
- [ Polka] ( #polka )
14
15
- [ grunt-contrib-connect] ( #grunt-contrib-connect )
@@ -83,6 +84,33 @@ app.use(apiProxy);
83
84
http .createServer (app).listen (3000 );
84
85
```
85
86
87
+ ## fastify
88
+
89
+ https://github.com/fastify/fastify [ ![ GitHub stars] ( https://img.shields.io/github/stars/fastify/fastify.svg?style=social&label=Star )] ( https://github.com/lukeed/polka )
90
+
91
+ ``` javascript
92
+ const fastify = require (' fastify' )({ logger: true });
93
+ const { createProxyMiddleware } = require (' http-proxy-middleware' );
94
+
95
+ (async () => {
96
+ await fastify .register (require (' fastify-express' ));
97
+
98
+ const proxy = createProxyMiddleware ({
99
+ target: ' http://jsonplaceholder.typicode.com' ,
100
+ changeOrigin: true ,
101
+ });
102
+
103
+ fastify .use (proxy);
104
+
105
+ fastify .listen (3000 , (err , address ) => {
106
+ if (err) throw err;
107
+ fastify .log .info (` server listening on ${ address} ` );
108
+ });
109
+ })();
110
+
111
+ // curl http://localhost:3000/users
112
+ ```
113
+
86
114
## lite-server
87
115
88
116
https://github.com/johnpapa/lite-server
You can’t perform that action at this time.
0 commit comments