diff --git a/Gruntfile.js b/Gruntfile.js index 215d264..b790984 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -44,7 +44,7 @@ module.exports = function(grunt) { 'resumes/**/*.less', 'less/**/*.less' ], - tasks: ['execute', 'babel', 'bgShell:express'], + tasks: ['execute', 'babel', 'bgShell:express', 'execute:wait'], options: { nospawn: false, livereload: true diff --git a/src/app.js b/src/app.js index 88aa021..e671750 100755 --- a/src/app.js +++ b/src/app.js @@ -17,7 +17,7 @@ process.argv.forEach(argument => { Server.kill(); break; case 'wait': - setTimeout(() => console.log('waiting'), 5000); + setTimeout(() => console.log('waiting'), 3000); break; } }); diff --git a/src/node/Server.js b/src/node/Server.js index f55c64b..0a3aa97 100755 --- a/src/node/Server.js +++ b/src/node/Server.js @@ -5,6 +5,9 @@ const Config = require('./Config'); const Util = require('./Util'); const person = require('../person.js'); +const http = require('http'); +const reload = require('reload'); + let app, resumes; const Server = { /** @@ -60,6 +63,13 @@ const Server = { app.get('/kill', () => process.exit()); }, + /** + * does autorealod + */ + autoReload: function() { + const server = http.createServer(app); + reload(server, app); + }, /** * sets routes for each resume */ @@ -81,6 +91,7 @@ const Server = { Server.setKillRoute(); Server.kill(); await Util.setTimeout(500); + Server.autoReload(); Server.start(); } };