Commit 671e58c586cb9859099152a19c7699c3f0a0473a

Authored by Paul Wallace
1 parent 7c715c46f6
Exists in master

Revert "Add routes for crime data api call"

Bad Commit

This reverts commit 828f919706f8729f86c4cc81199075a4db0ecec7.

Showing 3 changed files with 1 additions and 40 deletions Side-by-side Diff

1 1 var express = require('express');
2   -var crime = require('./routes/crime');
3 2  
4   -
5 3 var app = express();
6 4  
7 5 app.set('port', (process.env.PORT || 5000));
8 6  
9   -app.use(express.static(__dirname + '../public'));
  7 +app.use(express.static(__dirname + '/public'));
10 8  
11 9 // views is directory for all template files
12 10 app.set('views', __dirname + '/views');
... ... @@ -19,8 +17,6 @@
19 17 app.get('/landing', function(request, response) {
20 18 response.render('pages/landing');
21 19 });
22   -
23   -app.get('/api', crime.view);
24 20  
25 21 app.listen(app.get('port'), function() {
26 22 console.log('Node app is running on port', app.get('port'));
routes/crime.js View file @ 671e58c
1   -var unirest = require('unirest');
2   -
3   -exports.view = function(req, res){
4   -
5   - unirest.get("https://yourmapper2.p.mashape.com/datasetlist?format=json&maxlat=40&maxlon=-70&minlat=30&minlon=-90&num=5&sort=location")
6   - .header("X-Mashape-Key", "gj4g6D3zxKmshys7yyf9KNbuywOxp1ueazFjsn6n2fK4sccIGA")
7   - .header("Accept", "application/json")
8   - .end(function (result) {
9   - // console.log(result.status, result.headers, result.body);
10   -
11   - });
12   -
13   -
14   -
15   - // These code snippets use an open-source library. http://unirest.io/nodejs
16   - unirest.get("https://crimescore.p.mashape.com/crimescore?f=json&id=174&lat=38.08809&lon=-85.679626")
17   - .header("X-Mashape-Key", "gj4g6D3zxKmshys7yyf9KNbuywOxp1ueazFjsn6n2fK4sccIGA")
18   - .header("Accept", "application/json")
19   - .end(function (result) {
20   - res.render('pages/tempcrime', result);
21   - });
22   -
23   -
24   -};
views/pages/tempcrime.ejs View file @ 671e58c
1   -<!DOCTYPE html>
2   -<html lang="en">
3   - <head>
4   - <% include ../partials/header %>
5   - </head>
6   -
7   - <body>
8   - <%= body %>
9   - </body>
10   -
11   - </html>