File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ Run the server:
19
19
20
20
``` sh
21
21
npm start
22
+
23
+ # or o use express with http-proxy-middleware
24
+ MODE=http-proxy-middleware npm start
22
25
```
23
26
24
27
Start meking requests from TTY:
@@ -36,6 +39,13 @@ Run docker-compose:
36
39
sudo docker-compose up --build
37
40
```
38
41
42
+ Dockerized environment uses express with http-proxy-middleware by default.
43
+ To use build-in http server remove thhe following line fron ` .env ` file:
44
+
45
+ ```
46
+ MODE=http-proxy-middleware
47
+ ```
48
+
39
49
## Memory leak
40
50
41
51
Running the above code results in a memoy leak and crush the server after a minute or so:
@@ -48,6 +58,8 @@ Running the above code results in a memoy leak and crush the server after a minu
48
58
49
59
> node --max-old-space-size=128 src/index.js
50
60
61
+ using http-proxy-middleware
62
+ [HPM] Proxy created: / -> http://127.0.0.1:5000
51
63
server is listenning on port 7000
52
64
(node:535729) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
53
65
(Use `node --trace-deprecation ...` to show where the warning was created)
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ const express = require('express');
2
2
const { createProxyMiddleware } = require ( 'http-proxy-middleware' ) ;
3
3
4
4
exports . createServer = ( target , port ) => {
5
+ console . log ( 'using http-proxy-middleware' ) ;
6
+
5
7
const server = express ( )
6
8
. use ( createProxyMiddleware ( { target } ) )
7
9
. listen ( port ) ;
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ const http = require('http');
2
2
const { createProxyServer } = require ( 'http-proxy' ) ;
3
3
4
4
exports . createServer = ( target , port ) => {
5
+ console . log ( 'using build-in http server' ) ;
6
+
5
7
const proxy = createProxyServer ( { target } ) ;
6
8
7
9
http
You can’t perform that action at this time.
0 commit comments