snuggie
bundle up your javascripts: a minimal HTTP API for browserify
npm install snuggie
usage
snuggie
is an http server
var snuggie =
or
var snuggieHandler = require('snuggie').handler
require('http').createServer(snuggieHandler).listen(8000)
or
var snuggie = require('snuggie').handler
require('http').createServer(function(req, res) {
snuggie(req, function(err, bundle) {})
}).listen(8000)
api
first you must make a PUT/POST request to snuggie where your request upload body contains an ascii a javascript program (no multipart form uploads allowed)
then snuggie will use browserify to bundle your program and send you back a bundle. any node module available to your node server will be available to snuggie
e.g. :
var request = request
the http response will be either:
"bundle": "// browserified bundle output contents"
or
"error": "// syntaxError or moduleMissing" "message": "// a hopefully helpful error message"
you can also just pass a function string and a callback:
snuggie
running the tests
npm test
runs the server side tests. to test that CORS works okay run node browser-test.js
and then open up localhost:8080
in a browser
license
BSD