Deployd can be used with express/connect. Deployd will attach functions and handler to express server object.
Here is a simple hello world using Deployd as an express middleware.
// hello-server-attach.js
var PORT = process.env.PORT || 3000;
var ENV = process.env.NODE_ENV || 'development';
// setup http + express + socket.io
var express = require('express');
var app = express();
var server = require('http').createServer(app);
var io = require('socket.io').listen(server, {'log level': 0});
// setup deployd
require('deployd').attach(server, {
socketIo: io, // if not provided, attach will create one for you.
env: ENV,
db: {host:'localhost', port:27017, name:'test-app'}
});
// After attach, express can use server.handleRequest as middleware
app.use(server.handleRequest);
// start server
server.listen(PORT);
Run this like any other express server.
node hello-server-attach.js
db.connectionString
is set, the other db options are ignored.Note: If options.env is "development", the dashboard will not require authentication and configuration will not be cached. Make sure to change this to "production" or something similar when deploying.
process.server
. This means you can only run one Deployd server in a process.process.cwd
. Add this to ensure you are in the right directory: process.chdir(__dirname)
./dashboard
without a key you must run Deployd with the env
option set to development
.Let us know if you have any ideas to improve our docs. Open an issue on github, send us an email, or tweet us.
This entire site, including documentation written in markdown is available on github. Pull requests are appreciated!