You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
varhttp=require("http")varpath=require("path")// Simple http routervarRouter=require("routes-router")// Simple static file servervarecstatic=require("ecstatic")varServeBrowserify=require("serve-browserify")varrouter=Router()// ServeBrowserify(opts) returns a http handler// to server browserified bundles. The suggestion is to// server /browserify/foo as /browser/foo/index.js or// /browserify/bar as /browser/bar.js// also /browserify/x/y as /browser/x/y.jsrouter.addRoute("/browserify/*",ServeBrowserify({root: path.join(__dirname,"browser"),base: "/browserify"}))// static server to serve html page for examplerouter.addRoute("/",ecstatic({root: path.join(__dirname,"static"),autoIndex: true}))varserver=http.createServer(router)server.listen(9024,function(){console.log("demo server listening on port 9024")})
ServeJavascript returns a function when given a root and opts will
serve javascript files through browserify
Valid options are:
root: The root folder location where it should look for
javascript files to browserify & serve
base: The base HTTP path where you are serving your assets
from. This is only needed if you want to serve nested files
cache: This will cache if enabled, which means every location
browserify bundle get's cached after initial compilation.
This also enables ETag's & HTTP caching
gzip: This will enable gzipping the bundle and sending it
as gzip'd encoded data to browsers if their accept-encoding
matches
cacheControl: This is a string you can set for the cache
control header. It defaults to 'max-age=300, must-revalidate'
debug: This is an option passed to browserify, when debug is
set, browserify will embed source maps. Disable this in
production to decrease file size