commit
b4b5240fdb
@ -1,3 +1,4 @@
|
||||
var path = require('path');
|
||||
var express = require('express');
|
||||
|
||||
module.exports.run = function(worker) {
|
||||
@ -6,10 +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.send('<html><body>' +
|
||||
'<p>It works! Now point your app and monitor app to connect to this server.</p>' +
|
||||
'</body></html>');
|
||||
res.render('index', { port: worker.options.port });
|
||||
});
|
||||
app.post('/', function(req, res) {
|
||||
if (!req.body.data) return res.status(404).end();
|
||||
|
@ -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"
|
||||
|
46
views/index.ejs
Normal file
46
views/index.ejs
Normal file
@ -0,0 +1,46 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>RemoteDev</title>
|
||||
<style>
|
||||
html {
|
||||
min-width: 350px;
|
||||
min-height: 300px;
|
||||
}
|
||||
body {
|
||||
position: fixed;
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
#root {
|
||||
height: 100%;
|
||||
}
|
||||
#root > div {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script src="//npmcdn.com/react@0.14/dist/react.min.js"></script>
|
||||
<script src="//npmcdn.com/react-dom@0.14/dist/react-dom.min.js"></script>
|
||||
<script src="//npmcdn.com/remotedev-app@0.2/dist/remotedev-app.min.js"></script>
|
||||
<script>
|
||||
window.remotedevOptions = {
|
||||
hostname: location.hostname,
|
||||
port: <%= port %>,
|
||||
autoReconnect: true
|
||||
};
|
||||
ReactDOM.render(
|
||||
React.createElement(RemoteDevApp, {
|
||||
socketOptions: window.remotedevOptions
|
||||
}),
|
||||
document.querySelector('#root')
|
||||
);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user