Friday, October 5, 2012

Local Appcache Dev with Express.js

‹prev | My Chain | next›

After some thought (and last night's pain), I plan to perform local development of the Gaming JavaScript the code editor under a simple express.js (v2.x) server.

I strip out nearly everything from the standard, generated express code in my local repository, leaving behind only what is necessary to serve up static resources from the current directory. The contents of app.js are then:
var express = require('express')
  , app = express.createServer();


app.listen(3000, function(){
    "Express server listening on port %d in %s mode",
I do not really need that console.log(), but I am used to seeing it when I spin a server:
➜  code-editor git:(gamingjs) ✗ node app
Express server listening on port 3000 in development mode
With that, and yesterday's removal of the manifest="editor.appcache" attribute from the HTML tag of code-editor's index.html, I am ready to code locally:

And that seems to do the trick. Eventually, I am able to build a list of templates that will be used for new projects (boy this is hard without jQuery):
var openNewDialog = function() {
  // ...
  var templateField = document.createElement( 'select' );
  templates.forEach(function(template) {
    var optionField = document.createElement( 'option' );
    optionField.textContent = template.filename;
  // ...
Which results in:

That will do for a stopping point today. I can live with this as a way for Gaming JavaScript kids to start new work. Up tomorrow: more fixes for the code editor.

Day #530

No comments:

Post a Comment