forked from andris-silis/heartbeat-monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
36 lines (25 loc) · 1013 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
var initApp = function () {
'use strict';
var express = require('express.io');
var app = express();
var path = require('path');
var views = require('./views');
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/heartbeat-monitor');
app.http().io();
console.log(path.join(__dirname, 'node_modules'));
console.log(__dirname);
app.use('/node_modules', express.static(path.join(__dirname, 'node_modules')));
app.use('/bower_components', express.static(path.join(__dirname, 'bower_components')));
app.use('/js', express.static(path.join(__dirname, 'js')));
app.get('/', views.clientHomepage);
app.get('/realtime', views.clientRealtimeHtml);
app.get('/history', views.clientHistoryHtml);
app.get('/-api/heartbeats', views.heartbeatData);
app.get('/-api/temperature', views.temperatureData);
// incoming heartbeat from bluetooth listener process
app.io.route('heartbeat', views.inputHeartbeat);
app.io.route('bpm', views.inputBPM);
app.listen(7076);
};
initApp();