-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.coffee
30 lines (24 loc) · 1023 Bytes
/
server.coffee
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
http = require 'http'
ss = require 'socketstream'
#single-page for desktop
ss.client.define 'main', {
view: 'desktop.html',
css: ['libs/bootstrap-responsive.css', 'libs/bootstrap.css', 'chat.styl'],
code: ['libs/jquery-1.10.2.js', 'libs/bootstrap.js', 'libs/handlesbar.js', 'libs/ember-1.0.0-rc.6.js', 'libs/moment.js', 'app'],
tmpl: 'chat'
}
# Serve desktop client on root URL
ss.http.route '/', (req, res) ->
res.serveClient 'main'
ss.client.formatters.add require 'ss-coffee'
ss.client.formatters.add require 'ss-stylus'
#ss.client.templateEngine.use require('ss-hogan'), '/hgn'
ss.client.templateEngine.use 'ember', '/chat'
#ss.client.templateEngine.use require('ss-handlebars'), '/hds'
#ss.client.templateEngine.use require 'ss-handlebars'
#Minimize and pack assets if you type: SS_ENV=production node app.js
if ss.env is 'production' then ss.client.packAssets()
server = http.Server ss.http.middleware
server.listen 3000
ss.start server
console.log 'Server running at http://0.0.0.0:3000/'