Commit f660af37 authored by 15김건우's avatar 15김건우

Change server.js to use fallback public.1

parent 67e5f3aa
...@@ -11,7 +11,7 @@ const app = express(); ...@@ -11,7 +11,7 @@ const app = express();
app.configure(() => { app.configure(() => {
app.set('port', process.env.PORT || 3001); app.set('port', process.env.PORT || 3001);
app.use(app.router); app.use(app.router);
app.use(express.static(path.join(__dirname, 'public'))); app.use(express.static(path.join(__dirname, 'public.1')));
app.use('/components', express.static(path.join(__dirname, 'components'))); app.use('/components', express.static(path.join(__dirname, 'components')));
}); });
...@@ -23,17 +23,21 @@ const socket = new faye.Client(`http://localhost:${app.get('port')}/faye`); ...@@ -23,17 +23,21 @@ const socket = new faye.Client(`http://localhost:${app.get('port')}/faye`);
// get request from socket -> set command to drone // get request from socket -> set command to drone
socket.subscribe('/drone/move', cmd => { socket.subscribe('/drone/move', cmd => {
console.log('move', cmd); console.log('move', cmd);
if (typeof drone[cmd.action] === "function") if (cmd.action == "calibrate") {
return drone[cmd.action](cmd.speed); console.log("calibrate");
drone[cmd.action](0);
}
else if (typeof drone[cmd.action] === "function")
drone[cmd.action](cmd.speed);
}); });
socket.subscribe('/drone/animate', cmd => { socket.subscribe('/drone/animate', cmd => {
console.log('animate', cmd); //console.log('animate', cmd);
return drone.animate(cmd.action, cmd.duration); // return drone.animate(cmd.action, cmd.duration);
}); });
socket.subscribe('/drone/drone', cmd => { socket.subscribe('/drone/drone', cmd => {
console.log('drone command: ', cmd); //console.log('drone command: ', cmd);
if (typeof drone[cmd.action] === "function") // if (typeof drone[cmd.action] === "function")
return drone[cmd.action](); // return drone[cmd.action]();
}); });
// start server // start server
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment