Skip to content

Commit bcb9a5f

Browse files
committed
some node code
1 parent 5c2cd70 commit bcb9a5f

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
**/*.swp
2+
**/node_modules

basic_proxy.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Usage : node basic_proxy.js [--port=PROXY_PORT] [--worker_ports=WORKER_PORT_0,WORKER_PORT_1,...]
2+
3+
var proxy = require('http-proxy')
4+
var argv = require('minimist')(process.argv)
5+
6+
if (argv.worker_ports.length === 0) { process.exit(1) }
7+
8+
var i = 0
9+
proxy.createServer((req, res, proxy) => {
10+
var this_port = argv.worker_ports[ (i++) % argv.worker_ports.length ]
11+
proxy.proxyRequest(req,res, this_port)
12+
}).listen(argv.port || 12480)
13+

package-lock.json

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "simple-ml-serving",
3+
"version": "1.0.0",
4+
"description": "https://github.com/hiveml/simple-ml-serving",
5+
"main": "basic_proxy.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/hiveml/simple-ml-serving.git"
12+
},
13+
"author": "",
14+
"license": "ISC",
15+
"bugs": {
16+
"url": "https://github.com/hiveml/simple-ml-serving/issues"
17+
},
18+
"homepage": "https://github.com/hiveml/simple-ml-serving#readme",
19+
"dependencies": {
20+
"http-proxy": "^1.16.2"
21+
}
22+
}

0 commit comments

Comments
 (0)