Browse Source

Merge pull request #172 from matiu/feat/local-bind

by dflt multiserver listen only to localhost
activeAddress
Ivan Socolsky 10 years ago
parent
commit
aec2f341d5
  1. 0
      bws.js
  2. 5
      multilevel/multilevel.js
  3. 2
      package.json

0
app.js → bws.js

5
multilevel/start.js → multilevel/multilevel.js

@ -1,3 +1,5 @@
#!/usr/bin/env node
var multilevel = require('multilevel'); var multilevel = require('multilevel');
var net = require('net'); var net = require('net');
var level = require('levelup'); var level = require('levelup');
@ -5,10 +7,11 @@ var level = require('levelup');
var db = level('./db', { var db = level('./db', {
valueEncoding: 'json' valueEncoding: 'json'
}); });
var HOST = 'localhost';
var PORT = 3002; var PORT = 3002;
console.log('Server started at port ' + PORT + '...'); console.log('Server started at port ' + PORT + '...');
net.createServer(function(con) { net.createServer(function(con) {
con.pipe(multilevel.server(db)).pipe(con); con.pipe(multilevel.server(db)).pipe(con);
}).listen(PORT); }).listen(PORT, HOST);

2
package.json

@ -51,7 +51,7 @@
"supertest": "*" "supertest": "*"
}, },
"scripts": { "scripts": {
"start": "node app.js", "start": "node bws.js",
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --reporter spec test", "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --reporter spec test",
"test": "./node_modules/.bin/mocha", "test": "./node_modules/.bin/mocha",
"coveralls": "./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage" "coveralls": "./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"

Loading…
Cancel
Save