-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathroutes.js
39 lines (33 loc) · 1.04 KB
/
routes.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
39
const express = require('express');
const router = express.Router();
const path = require('path');
var studentdata = require('./public/students');
// ROUTES for different types of maps
router.get('/', (req, res) => {
console.log('in / route!');
res.sendFile(path.join(__dirname + '/public/layouts/index_markers.html'));
});
router.get('/markers', (req, res) => {
console.log('in /markers route!');
res.sendFile(path.join(__dirname + '/public/layouts/index_images.html'));
});
router.get('/heatmap', (req, res) => {
console.log('in /heatmap route!');
res.sendFile(path.join(__dirname + '/public/layouts/index_heat.html'));
});
// process student json, create markers obj
var markers = ["amanda"];
studentdata.forEach(function(std, i) {
markers[i] = {
col: std.College,
lat: std.Latitude,
long: std.Longitude,
icon: std.URL
}
})
// ROUTE to get student json
router.get('/Kpcr1ukvkd9toBN3dAWE', function(req, res) {
console.log('in map route! -- ', studentdata[0]);
res.send(JSON.stringify(markers));
});
module.exports = router;