-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
39 lines (30 loc) · 1.08 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var http = require('http')
, ss = require('socketstream')
, redis = require('redis')
, db = redis.createClient();
ss.client.define('main', {
view: 'app.jade',
css: ['libs', 'app.styl'],
code: ['libs', 'app']
});
ss.http.router.on('/', function(req, res) {
res.serveClient('main');
});
// Remove to use only plain .js, .html and .css files if you prefer
ss.client.formatters.add(require('ss-coffee'));
ss.client.formatters.add(require('ss-jade'));
ss.client.formatters.add(require('ss-stylus'));
// Use server-side compiled Hogan (Mustache) templates. Others engines available
ss.client.templateEngine.use(require('ss-hogan'));
// Minimise and pack assets if you type SS_ENV=production node app.js
if (ss.env == 'production') ss.client.packAssets();
// Enable optional console server access. Run 'ss-client' to connect
var consoleServer = require('ss-console').init(ss);
consoleServer.listen(5000);
// Redis
ss.session.store.use('redis');
ss.publish.transport.use('redis');
// Start web server
var server = http.Server(ss.http.middleware);
server.listen(3000);
ss.start(server);