-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathjackconfig.js
58 lines (50 loc) · 2.07 KB
/
jackconfig.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* The starting point for Pintura running as a Jack app.
*/
var Transporter, pinturaApp;
//require("nodules").useLocal().ensure(["pintura/pintura", "lib/app", "tunguska/jack-connector", "narwhal/lib/narwhal/repl", "transporter/jsgi/transporter"], function(require){
Transporter = require("transporter/jsgi/transporter").Transporter;
//require.reloadable(function(){
// this will provide access to the server side JS libraries from the client
pinturaApp = //Transporter({loader: require("nodules").forEngine("browser").useLocal().getModuleSource},
// the main app
require("pintura/pintura").app;
require("./app");
//});
require("tunguska/jack-connector").observe("worker", pinturaApp.addConnection);
// we start the REPL (the interactive JS console) because it is really helpful
if(require("jack/lib/jack/handler/simple-worker").options.firstWorker){
require("narwhal/lib/narwhal/repl").repl(true);
}
//});
var File = require("file");
var perseverePath,
Static = require("jack/static").Static,
Directory = require("jack/dir").Directory;
var path = require.paths[0].match(/(.*?)[\/\\]packages[\/\\]/);
if(path){
perseverePath = path[1] + "/packages/persevere/public";
}
// now setup the development environment, handle static files before reloading the app
// for better performance
exports.app = exports.development = function(app, options){
// make the root url redirect to /Page/Root
return require("./lib/jsgi/redirect-root").RedirectRoot(require("jack/redirect").Redirect,
require("jack/cascade").Cascade([
// cascade from static to pintura REST handling
/* // this will provide module wrapping for the Dojo modules for the client
transporter.Transporter({
urlPrefix:"/js/",
paths:["../../persevere/public/js/"],
converter: transporter.Dojo
}),*/
// the main place for static files accessible from the web
Directory("public", Static(null, {urls:[""], root: "public"})),
Static(null, {urls:["/explorer"], root: perseverePath + "/explorer"}),
// main Pintura handler
function(request){
return pinturaApp(request);
}
])
);
};