Skip to content

Instantly share code, notes, and snippets.

@zackproser
Last active August 29, 2015 14:24
Show Gist options
  • Save zackproser/25361906b92d13952c84 to your computer and use it in GitHub Desktop.
Save zackproser/25361906b92d13952c84 to your computer and use it in GitHub Desktop.
A quick fileserver utility in Node.js, run from within a Phaser game project root, that makes it easy to test your game via the browser
var
express = require('express'),
app = express(),
port = 8080
;
//Set the 'static' directory to the project root - where index.html resides
app.use(express.static('./'));
//When root is requested, send index.html as a response
app.get('/', function(req, res){
res.send('index.html');
});
//Create the server by listening on the desired port
var server = app.listen(port, function() {
console.log('Visit localhost:' + port + ' to see your Phaser game');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment