From 7dbd60c155eb1c961023fbc7bde39b52f8b1ff40 Mon Sep 17 00:00:00 2001 From: Jhen Date: Wed, 10 Feb 2016 12:29:12 +0800 Subject: [PATCH 1/2] Include remotedev-app --- bin/index.html | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ bin/worker.js | 5 ++--- 2 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 bin/index.html diff --git a/bin/index.html b/bin/index.html new file mode 100644 index 0000000..e057b5d --- /dev/null +++ b/bin/index.html @@ -0,0 +1,48 @@ + + + + + RemoteDev + + + +
+ + + + + + diff --git a/bin/worker.js b/bin/worker.js index 0ab7cca..18aba97 100644 --- a/bin/worker.js +++ b/bin/worker.js @@ -1,3 +1,4 @@ +var path = require('path'); var express = require('express'); module.exports.run = function(worker) { @@ -7,9 +8,7 @@ module.exports.run = function(worker) { httpServer.on('request', app); app.get('/', function(req, res) { - res.send('' + - '

It works! Now point your app and monitor app to connect to this server.

' + - ''); + res.sendFile(path.join(__dirname, 'index.html')); }); app.post('/', function(req, res) { if (!req.body.data) return res.status(404).end(); From 0269d0ce20784414b58b6b5a0ad0bb9e5067ba43 Mon Sep 17 00:00:00 2001 From: Jhen Date: Fri, 19 Feb 2016 11:56:55 +0800 Subject: [PATCH 2/2] Render worker.options.port --- bin/worker.js | 4 +++- package.json | 4 +++- bin/index.html => views/index.ejs | 8 +++----- 3 files changed, 9 insertions(+), 7 deletions(-) rename bin/index.html => views/index.ejs (86%) diff --git a/bin/worker.js b/bin/worker.js index 18aba97..8aa6f1e 100644 --- a/bin/worker.js +++ b/bin/worker.js @@ -7,8 +7,10 @@ module.exports.run = function(worker) { var scServer = worker.scServer; httpServer.on('request', app); + + app.set('view engine', 'ejs'); app.get('/', function(req, res) { - res.sendFile(path.join(__dirname, 'index.html')); + res.render('index', { port: worker.options.port }); }); app.post('/', function(req, res) { if (!req.body.data) return res.status(404).end(); diff --git a/package.json b/package.json index c4fdaae..1e8c06b 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "remotedev": "bin/remotedev.js" }, "files": [ - "bin" + "bin", + "views" ], "repository": { "type": "git", @@ -24,6 +25,7 @@ }, "homepage": "https://github.com/zalmoxisus/remotedev-server", "dependencies": { + "ejs": "^2.4.1", "express": "^4.13.3", "minimist": "^1.2.0", "socketcluster": "^4.3.1" diff --git a/bin/index.html b/views/index.ejs similarity index 86% rename from bin/index.html rename to views/index.ejs index e057b5d..f80af41 100644 --- a/bin/index.html +++ b/views/index.ejs @@ -30,16 +30,14 @@