From 084bd69ab63d69a13c259130916d511d809b05cd Mon Sep 17 00:00:00 2001
From: Paul Wallace <paulwallace@Pauls-MacBook-Air.local>
Date: Thu, 3 Nov 2016 12:26:55 -0700
Subject: [PATCH] Add routes for crime stuff

---
 index.js                  |  3 +++
 routes/crime.js           | 24 ++++++++++++++++++++++++
 views/pages/tempcrime.ejs | 11 +++++++++++
 3 files changed, 38 insertions(+)
 create mode 100644 routes/crime.js
 create mode 100644 views/pages/tempcrime.ejs

diff --git a/index.js b/index.js
index 3f6c72e..f8b4a14 100644
--- a/index.js
+++ b/index.js
@@ -1,6 +1,7 @@
 var express = require('express');
 
 var app = express();
+var app = require('/crime');
 
 app.set('port', (process.env.PORT || 5000));
 
@@ -18,6 +19,8 @@ app.get('/landing', function(request, response) {
   response.render('pages/landing');
 });
 
+app.get('/crime', crime.index);
+
 app.listen(app.get('port'), function() {
   console.log('Node app is running on port', app.get('port'));
 });
diff --git a/routes/crime.js b/routes/crime.js
new file mode 100644
index 0000000..97decab
--- /dev/null
+++ b/routes/crime.js
@@ -0,0 +1,24 @@
+var unirest = require('unirest');
+
+exports.view = function(req, res){
+
+	unirest.get("https://yourmapper2.p.mashape.com/datasetlist?format=json&maxlat=40&maxlon=-70&minlat=30&minlon=-90&num=5&sort=location")
+	.header("X-Mashape-Key", "gj4g6D3zxKmshys7yyf9KNbuywOxp1ueazFjsn6n2fK4sccIGA")
+	.header("Accept", "application/json")
+	.end(function (result) {
+  // console.log(result.status, result.headers, result.body);
+  
+	});
+
+
+
+	// These code snippets use an open-source library. http://unirest.io/nodejs
+	unirest.get("https://crimescore.p.mashape.com/crimescore?f=json&id=174&lat=38.08809&lon=-85.679626")
+	.header("X-Mashape-Key", "gj4g6D3zxKmshys7yyf9KNbuywOxp1ueazFjsn6n2fK4sccIGA")
+	.header("Accept", "application/json")
+	.end(function (result) {
+	  res.render('pages/tempcrime', result);
+	});
+
+	
+};
\ No newline at end of file
diff --git a/views/pages/tempcrime.ejs b/views/pages/tempcrime.ejs
new file mode 100644
index 0000000..0ff90f7
--- /dev/null
+++ b/views/pages/tempcrime.ejs
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <% include ../partials/header %>
+  </head>
+
+  <body>
+  	<%= body %>
+  </body>
+
+ </html>
\ No newline at end of file
-- 
1.9.1