Example #1
0
	start = require("pintura/start-node").start,
	multiNode = require("multi-node/multi-node");

require.reloadable(function(){
	pinturaApp = require("pintura/pintura").app;
	require("app");
});
start(
	// uncomment this to enable compression with node-compress
	//require("pintura/jsgi/compress").Compress(
	// make the root url redirect to /Page/Root  
	require("./jsgi/redirect-root").RedirectRoot(
		require("pintura/jsgi/cascade").Cascade([ 
		// cascade from static to pintura REST handling
			// the main place for static files accessible from the web
			Static({urls:[""], root: "public", directoryListing: true}),
			Static({urls:["/explorer"], root: require("nodules").getCachePath("persevere-client/") + "/explorer"}),
			// this will provide access to the server side JS libraries from the client
			require("transporter/jsgi/transporter").Transporter({
				loader: require("nodules").forBrowser().useLocal().getModuleSource}),
				// main pintura app
				function(request){
					return pinturaApp(request);
				}
		])
	)
//)
);

// this is just to ensure the static analysis preloads the explorer package
false&&require("persevere-client/explorer/explorer.js"); 
Example #2
0
	Static = require("pintura/jsgi/static").Static,
	start = require("pintura/start-node").start;
function setPinturaApp(){
	pinturaApp = require("pintura/pintura").app;
	require("./app");
}
require.reloadable ? require.reloadable(setPinturaApp) : setPinturaApp();
start(
	// uncomment this to enable compression with node-compress
	//require("pintura/jsgi/compress").Compress(
	// make the root url redirect to /Page/Root  
	require("./jsgi/redirect-root").RedirectRoot(
		require("pintura/jsgi/cascade").Cascade([ 
		// cascade from static to pintura REST handling
			// the main place for static files accessible from the web
			Static({urls:["/public"], root: "public", directoryListing: true}),
			Static({urls:["/packages"], root: require.resolve("pintura/pintura").replace(/pintura[\\\/]pintura.js$/,''), directoryListing: true}),
//			Static({urls:["/explorer"], root: require.resolve("persevere/persvr").replace(/persvr.js$/,'') + "/explorer"}),
			// this will provide access to the server side JS libraries from the client
			pinturaApp
		])
	)
//)
);

if(require.main == module){
	require("repl").start();
}
// this is just to ensure the static analysis preloads the explorer package
false&&require("persevere-client/explorer/explorer.js"); 
Example #3
0
// helpful for debugging
var Static = require("pintura/jsgi/static").Static,
	comet = require("tunguska/jsgi/comet"),
	hub = require("tunguska/hub"),
	jsgiApp = require("pintura/jsgi/cascade").Cascade([ 
		// cascade from static to pintura REST handling
			// the main place for static files accessible from the web
			Static({urls:[""], root: "public", directoryListing: true}),
			comet.Notifications(["test"])
		]),


	ws = require("ws/server"),
	http = require("http").createServer(
			require("jsgi-node/jsgi-node").Listener(jsgiApp)
	);
	var wsServer = ws.createServer({
		server: http
	});
	require("jsgi-node/ws-jsgi")(wsServer, function(request){
		request.headers.stream = true;
		return jsgiApp(request);
	});
	http.listen(8080);
setInterval(function(){
	hub.publish("test", "hi there");
}, 2000);