Skip to content

Instantly share code, notes, and snippets.

@jkeyes
Last active December 10, 2015 06:18
Show Gist options
  • Save jkeyes/4393079 to your computer and use it in GitHub Desktop.
Save jkeyes/4393079 to your computer and use it in GitHub Desktop.
Updated sample code for the "Stitch It Up" example from "The Little Book of CoffeeScript".
"use strict"
require("coffee-script")
stitch = require("stitch")
express = require("express")
argv = process.argv.slice(2)
pkg = stitch.createPackage(
# Specify the paths you want Stitch to automatically bundle up
paths: [ __dirname + "/app"],
# Specify your base libraries
dependencies: [
# __dirname + '/lib/jquery.js'
]
)
app = express()
app.configure ->
app.set "views", __dirname + "/views"
app.use app.router
app.use express.static(__dirname + "/public")
app.get "/application.js", pkg.createServer()
port = argv[0] or process.env.PORT or 9294
console.log("Starting server on port #{port}")
app.listen port
Starting server on port 9294
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment