Jump To …

server.coffee

Lepidoptera

Lepidoptera is an example solution built on top of Swarm This is the server component, which allows for viewing a fleet a vehicles

Installation

Lepidoptera requires Node.js (brew install node) and npm (curl http://npmjs.org/install.sh | sh) Once npm is available,

npm install
npm start

Usage

Browse 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()

Configuration

The 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 }

Routing

To see a map of all the location feeds, GET /locations

app.get '/locations', (req, res) ->
  res.render 'map', locals: { config: config }

app.use gzippo.staticGzip(__dirname + '/public')
app.use app.router
app.listen 80