[go: up one dir, main page]

Skip to content

wbellan/node-mongrel2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Notice

Please see m2njs!

Since taking over this abandoned project, I have updated the source, and republished under m2njs. You can install the latest version of this Mongrel2 handler for Node.js using npm:

npm install m2njs

With that said, the instructions below are still valid and work, with exception of 'mongrel2' now becomes 'm2njs'.

node-mongrel2

A Mongrel2 handler for nodejs.

Howto

This isn't an intro to Mongrel2. Try the Mongrel2 Manual for that.

Install with npm:

% npm install mongrel2

Use it in your code:

var mongrel2 = require('mongrel2');

// mongrel2.connect(recv_spec, send_spec, identify, callback)
// recv_spec is what you configure as your send_spec in your mongrel2.conf
// send_spec is vice versa
mongrel2.connect('tcp://127.0.0.1:9997', 'tcp://127.0.0.1:9996', 'test', function(msg, reply) {
  // do some logic
  reply(200, { 'Content-Type': 'text/plain' }, "Hello, World!\n" + JSON.stringify(msg));
});

Copyright

Copyright (c) 2010 Daniel Huckstep. See LICENSE for details.