Last active
August 29, 2015 14:24
-
-
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
This file contains 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
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