forked from socketstream/socketstream
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
30 lines (22 loc) · 827 Bytes
/
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
// My SocketStream app
var http = require('http')
, ss = require('socketstream');
ss.client.define('main', {
view: 'app.jade',
css: ['libs', 'app.styl'],
code: ['libs', 'modules', 'main']
});
ss.http.router.on('/', function(req, res) {
res.serve('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();
var server = http.Server(ss.http.middleware);
server.listen(3000);
ss.start(server);