0.0.8 • Published 8 years ago

servlet v0.0.8

Weekly downloads
41
License
(ISC OR GPL-3.0)
Repository
github
Last release
8 years ago

servlet

run multiple servers in one node.js process, restarting individual servers when their code files change on disk

servlet uses fs.watch to monitor server module source files and its own configuration file. Modules are reloaded to realize changes immediately.

Running servlet

As root:

> servlet config.conf 80 wwwdata:wwwdata

As an unpriviliged user:

> servlet config.conf 8080

Example config

[
  { "host": "project1.example.com", "file": "./project1/index.js" },
  { "host": "project2.example.com", "file": "../funstuff/server.js" }
]

Example servlet

var app = require('http').createServer(function(req,res){res.end(req.url)})
exports.start = function( options ) {
  // start listening on the port assigned to the servlet
  app.listen( options.port );
}
exports.stop = function() {
  // clean up
  app.close();
}

Launching and respawning with upstart

On Ubuntu systems upstart can be used to launch servlet at boot time and keep it running. Check out node-servlet.conf for an upstart example config file.

0.0.8

8 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago