Created
April 15, 2010 19:52
-
-
Save dmachi/367560 to your computer and use it in GitHub Desktop.
Pintura on Titanium Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <title>Pintura Startup</title> | |
| </head> | |
| <body> | |
| <script type="text/javascript"> | |
| require=Titanium.CommonJS.require; | |
| print = Titanium.API.info; | |
| var pintura = require("pintura"); | |
| require("ExamplePinturaApp/app"); | |
| var options= { | |
| 'port': 8888, | |
| 'host': "127.0.0.1" | |
| }; | |
| var pinturaSrv = require("JsgiHandler"); | |
| // main app make the root url redirect to /Page/Root | |
| var app =require("ExamplePinturaApp/jsgi/redirect-root").RedirectRoot(pintura.app); | |
| // now setup the development environment, handle static files before reloading the app | |
| // for better performance | |
| var File = require("file"); | |
| var development = function(app, options){ | |
| Titanium.API.debug("[DEVELOPMENT] Request: " + app.pathInfo); | |
| return require("jack/cascade").Cascade([ | |
| // cascade from static to pintura REST handling | |
| // the main place for static files accessible from the web | |
| require("jack/static").Static(null, { | |
| urls:["/admin.html", "/edit.html"], | |
| root:Titanium.App.appURLToPath("app://CommonJS/ExamplePinturaApp/public")}), | |
| // this will provide access to the server side JS libraries from the client | |
| //require("jsgi/transporter").Transporter(), | |
| app | |
| ]); | |
| }; | |
| pinturaSrv.run(development, options); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment