Last active
December 18, 2015 00:19
-
-
Save daimajia/5695899 to your computer and use it in GitHub Desktop.
Revisions
-
代码家 revised this gist
Jun 3, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ email: [email protected] any question feel free to email me :) */ -
代码家 created this gist
Jun 3, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,68 @@ /* author: daimajia name: appjs Express example email: [email protected] any question feel free to email me: */ var appjs = module.exports = require('appjs'); var express = require('express'); var utils = require('util');// Create express server for routing appjs.serveFilesFrom(__dirname + '/content'); var appRouter = express(); /* *This is default views jade files directory. *Remeber to create a index.jade file in this directory. */ appRouter.set('views',__dirname + '/content'); appRouter.use(express.bodyParser()); appRouter.engine('jade', require('jade').__express); appRouter.engine('html', require('ejs').renderFile); /** * Set up the express routes */ appRouter.get('/', function(req, res, next){ res.render('index.jade', { name: 'Hello Jade!' }); }); appRouter.use(express.static(__dirname + '/content')); /** * Setup AppJS */ // override AppJS's built in request handler with connect appjs.router.handle = appRouter.handle.bind(appRouter); // have express listen on a port:51686 appRouter.listen(23453); var window = appjs.createWindow('http://localhost:23453/', { width : 640, height: 460, icons : __dirname + '/content/icons' }); window.on('create', function(){ console.log("Window Created"); window.frame.show(); window.frame.center(); }); window.on('ready', function(){ window.require = require; window.process = process; window.module = module; });