From ca4d83f44af01e896231e7df39c186e72b20479a Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 22 Jun 2015 02:34:54 -0400 Subject: [PATCH] docs(help) Using as Middleware --- HELP.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/HELP.md b/HELP.md index 0102e7be..fa7ddc0a 100644 --- a/HELP.md +++ b/HELP.md @@ -253,6 +253,35 @@ It could happen when mobile device, tablet or small window size used to work wit ![One panel mode](/img/screen/one-panel-mode.png "One panel mode") +Using as Middleware +--------------- + +Cloud Commander could be used as middleware for `node.js` applications based on [socket.io](http://socket.io "Socket.IO") and [express](http://expressjs.com "Express"): + +```js +var http = require('http'), + cloudcmd = require('cloudcmd'), + express = require('express'), + io = require('socket.io'), + app = express(), + + PORT = 31337, + + server, + socket; + +server = http.createServer(app); +socket = io.listen(server); + +app.use(cloudcmd({ + prefix: '/prefix', /* base URL (optional) */ + socket: socket, /* used by Config, Edit (optional) and Console (required) */ + config: {} /* config data (optional) */ +})); + +server.listen(PORT); +``` + Server --------------- Standard practices say no non-root process gets to talk to