-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathapp.coffee
More file actions
31 lines (24 loc) · 722 Bytes
/
app.coffee
File metadata and controls
31 lines (24 loc) · 722 Bytes
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
# My SocketStream 0.3 app
http = require("http")
ss = require("socketstream")
# Define a single-page client called 'main'
ss.client.define "main",
view: "app.html"
css: ["app.styl", "libs"]
code: ["libs", "app"]
#tmpl: "*"
# Serve this client on the root URL
ss.http.route "/", (req, res) ->
res.serveClient "main"
# Code Formatters
ss.client.formatters.add require("ss-stylus")
# Minimize and pack assets if you type: SS_ENV=production node app.js
ss.client.packAssets() if ss.env is "production"
# Start web server
server = http.Server(ss.http.middleware)
server.listen 3000
# Start SocketStream
ss.start server
# Start arduino
arduino = require './server/rpc/arduino'
arduino.start('/dev/ttyACM0', ss)