server.coffee | |
|---|---|
LepidopteraLepidoptera is an example solution built on top of Swarm This is the server component, which allows for viewing a fleet a vehicles | |
InstallationLepidoptera requires Node.js ( | |
UsageBrowse http://localhost/locations to witness the magic You will also want to look at Faker which can create said magic | express = require 'express'
gzippo = require 'gzippo'
app = express.createServer() |
ConfigurationThe config file is config.json, which is shared between server and faker | config = JSON.parse require('fs').readFileSync './config.json', 'utf8'
app.set 'view engine', 'jade'
app.set 'view options', { layout: false } |
RoutingTo see a map of all the location feeds, GET | app.get '/locations', (req, res) ->
res.render 'map', locals: { config: config }
app.use gzippo.staticGzip(__dirname + '/public')
app.use app.router
app.listen 80
|