Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    mario-mariopublic

    mario-mario Build Status

    Quick and easy class for defining your plumbing with express.io and socket.io for RESTful and Web Sockets programming.

    Usage

    var mario = require('mario');
    mario.plumbing({
    	port: 10000,
    	http: {
    		get: {
    			'/' : function (q,r) {
    				return r.send('<!doctype html><html><script src=\'socket.io/socket.io.js\'></script></html>');
    			},
    			'/echo' : function (q,r) {
    				return r.send({
    					echo : 'GET /echo'
    				});
    			}
    		},
    		post: {
    			'/echo' : function (q,r) {
    				return r.send({
    					echo : 'POST /echo'
    				});
    			}
    		}
    	},
    	socket: {
    		'unicast:echo' : function (q) {
    			return q.io.emit('unicast:echo','unicast:echo');
    		},
    		'broadcast:echo' : function (q) {
    			return q.io.broadcast('broadcast:echo','broadcast:echo');
    		}
    	}
    });
    

    Keywords

    none

    install

    npm i mario-mario

    Downloadsweekly downloads

    21

    version

    0.0.7-lite

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar