-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
39 lines (26 loc) · 941 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var express = require('express'),
app = express(),
server = require('http').createServer(app),
io = require('socket.io').listen(server),
request = require('request'),
exphbs = require('express3-handlebars'),
path = require('path'),
baseContext = {
title: "Hydro-π",
subtitle: ""
},
Scheduler = require("hydro-pi-scheduler");
app.use("/api", Scheduler);
server.listen(8080, "0.0.0.0");
var userSocket = io.on('connection', function (socket) {
//setInterval(sendTest.bind(socket), 6000);
io.sockets.emit("hey", {data: "Stuff"});
});
app.use("/js", express.static(path.join(__dirname, '/public/js/')));
app.use("/css", express.static(path.join(__dirname, '/public/css/')));
app.use("/img", express.static(path.join(__dirname, '/public/img/')));
app.engine('handlebars', exphbs({defaultLayout: 'main'}));
app.set('view engine', 'handlebars');
app.get('/', function (req, res, next) {
res.render('home');
});