New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

simple-virtual-hosts

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-virtual-hosts - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

9

lib/index.js
'use strict';
var Router = require('./router');
var http = require('http'),
Router = require('./router');

@@ -26,1 +27,7 @@ module.exports = VirtualHosts;

};
VirtualHosts.prototype.listen = function () {
this._server = this._server || http.createServer(this.dispatch);
this._server.listen.apply(this._server, arguments);
return this;
};

13

lib/router.js

@@ -20,9 +20,8 @@ 'use strict';

if (!handlers[host]) {
var regex = new RegExp('(^|(.+\\.))' + host + '$');
console.log(regex);
var hostMeta = {
host: host,
test: regex.test.bind(regex),
parts: host.split('.').length
};
var regex = new RegExp('(^|(.+\\.))' + host + '$'),
hostMeta = {
host: host,
test: regex.test.bind(regex),
parts: host.split('.').length
};

@@ -29,0 +28,0 @@ hosts.push(hostMeta);

{
"name": "simple-virtual-hosts",
"version": "0.0.1",
"version": "0.0.2",
"description": "A simple hostname router",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -5,9 +5,6 @@ 'use strict';

var vhost = new VirtualHosts()
new VirtualHosts()
.when('example.com', serveWeb)
.when('web.api.example.com', serveWeb)
.when('api.example.com', serveApi);
require('http')
.createServer(vhost.dispatch)
.when('api.example.com', serveApi)
.listen(10000);

@@ -14,0 +11,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc