From 017a87c50a1a9e413ef0075d5b323e3e891200f0 Mon Sep 17 00:00:00 2001 From: manufacturedba Date: Fri, 22 May 2015 18:46:27 -0500 Subject: [PATCH 1/2] Server for serving up game application --- package.json | 25 +++++++++++++++++++++++++ server.js | 22 ++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 package.json create mode 100644 server.js diff --git a/package.json b/package.json new file mode 100644 index 0000000..f4fbf7f --- /dev/null +++ b/package.json @@ -0,0 +1,25 @@ +{ + "name": "centipede", + "version": "0.0.0", + "description": "The arcade game Centipede we know and love but rewritten in HTML5. Game engine: Phaser. Check them out. Cool stuff, great community.", + "main": "server.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "start": "node server.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/rkram5424/HTML5-Centipede" + }, + "author": "Ryan Kramlich ", + "license": "ISC", + "bugs": { + "url": "https://github.com/rkram5424/HTML5-Centipede/issues" + }, + "homepage": "https://github.com/manufacturedba/HTML5-Centipede", + "devDependencies": { + "restify": "~2.8.5", + "grunt-contrib-watch": "~0.6.1", + "grunt": "~0.4.5" + } +} diff --git a/server.js b/server.js new file mode 100644 index 0000000..caf1ff5 --- /dev/null +++ b/server.js @@ -0,0 +1,22 @@ +var fs = require('fs'); +var restify = require('restify'); +var server = restify.createServer(); + +server.get(/.*/, restify.serveStatic({ + directory: __dirname, + default: 'index.html' +})); + +server.get('/', function(req, res, done){ + fs.readFile('index.html', 'utf8', function(err, html){ + if(err) throw err; + res.setHeader('Content-type', 'text/html'); + res.write(html); + res.end(); + return done(); + }); +}); + +server.listen(8080, function(){ + console.log('Listening at ' + server.url); +}); From a5b191eccf94ed30a40464859c32c1c8f0d3fde2 Mon Sep 17 00:00:00 2001 From: manufacturedba Date: Fri, 22 May 2015 18:47:27 -0500 Subject: [PATCH 2/2] Added instructions for running. Bonus grunt watch task for livereloading. Added node_modules directory to .gitignore --- .gitignore | 1 + Gruntfile.js | 12 ++++++++++++ README.md | 8 +++++++- 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 Gruntfile.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..414ef58 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,12 @@ +module.exports = function(grunt){ + grunt.initConfig({ + watch: { + files: ["**/*.*"], + options: { + livereload: true + } + } + }); + + grunt.loadNpmTasks('grunt-contrib-watch'); +} diff --git a/README.md b/README.md index a23f6d8..fd27fb8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # HTML5-Centipede -The arcade game Centipede we know and love but rewritten in HTML5. +The arcade game Centipede we know and love but rewritten in HTML5. Game engine: Phaser. Check them out. Cool stuff, great community. This is the first in my mission to revitalize a few classic arcade games. + +## Running +1. npm install +2. npm start + +Optionally run grunt watch for livereload