move to /flappy-bird

This commit is contained in:
Mahdi Dibaiee 2017-04-05 21:07:20 +04:30
parent 4265d4b96a
commit dc1fe02d59
3 changed files with 9 additions and 9 deletions

View File

@ -4,17 +4,18 @@ var express = require('express'),
io = require('socket.io')(server)
exec = require('child_process').exec
compression = require('compression')
path = require('path');
path = require('path'),
router = express.Router();
server.listen(8088);
app.use(express.static(__dirname + '/static'))
app.use(compression())
app.use('/assets/', express.static(__dirname + '/../assets/'))
router.use(express.static(__dirname + '/static'))
router.use(compression())
router.use('/assets/', express.static(__dirname + '/../assets/'))
var record = path.resolve(__dirname, '../record.py');
app.get('/play', function(request, response) {
router.get('/play', function(request, response) {
var child = exec('python3 ' + record, { maxBuffer: 1024 * 5000 }, function(err, out, stderr) {
if (err || stderr) {
console.log(err || stderr)
@ -26,3 +27,5 @@ app.get('/play', function(request, response) {
child.stdout.pipe(response);
});
app.use('/flappy-bird', router);

View File

@ -3,9 +3,6 @@
<title>Playing Flappy Bird using Evolution Strategies</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="author" content="Nebez Briefkani" />
<meta name="description" content="play floppy bird. a remake of popular game flappy bird using just html/css/js" />
<meta name="keywords" content="flappybird,flappy,bird,floppybird,floppy,html,html5,css,css3,js,javascript,jquery,github,nebez,briefkani,nebezb,open,source,opensource" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<!-- Open Graph tags -->

View File

@ -513,7 +513,7 @@ function newGame() {
$('#loading').addClass('active');
fetch('/play').then(res => res.json()).then(function(states) {
fetch('play').then(res => res.json()).then(function(states) {
playing = true;
$('#loading').removeClass('active');