mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
docs(help) Using as Middleware
This commit is contained in:
parent
b9eab52f8b
commit
ca4d83f44a
1 changed files with 29 additions and 0 deletions
29
HELP.md
29
HELP.md
|
|
@ -253,6 +253,35 @@ It could happen when mobile device, tablet or small window size used to work wit
|
|||
|
||||

|
||||
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue