var models = require('../models');
var express = require('express');
var router = express.Router();
var Sequelize = require('sequelize');
var incident = require('../models/traffic_data');

//EJL-Incident
router.get('/area/:area', function(req, res) {
  console.log(req.param);
  models.incident
    .findAll({
      where: {
        area: req.param("area")}
      })
    .then(function(incidents){
      res.json(incidents);
    });
  });

// sequelize.query("SELECT type FROM incident WHERE area = 'incident[i].area", 
//   { replacements: ['active'], type: sequelize.QueryTypes.SELECT}
//     ).then(function(incidentByArea) {
//       console.log('incidents by area: ', incidentByArea);
//   });

// Session.find({
//   where: ['user_id=? or token=? or expires > NOW()', someNumber, someString] 
// }).on('success', function(s) {

// });

// Session.find({
//   where: {id: incident},
//   include: {type: mockData, location: mockData, area: mockData}
// });

// var Data = function (sequelize, Sequelize) {

//   Data.findOrCreate({
//     where: {
//       type: mockData,
//       location: mockData,
//       area: mockData
//     },
//     defaults: {

//     }
//   }).spread(function(data, incident) {
//     console.log(data.values);
//   }).fail(function(err) {
//     console.log('Error occured', err);
//   });
// };

module.exports = router;
@@ -188,20 +188,16 @@
 %0A%0A//
-EJL-Incident
+GET Area
 %0Arou
@@ -341,16 +341,14 @@
 aram
-(%22
+s.
 area
-%22)
 %7D%0A  
@@ -420,23 +420,274 @@
     %7D);%0A
-
   %7D);%0A%0A
+//GET Types%0Arouter.get('/type/:type', function(req, res) %7B%0A  console.log(req.param(%22type%22));%0A  models.incident%0A    .findAll(%7B%0A      where: %7B%0A        type: req.params.type%7D%0A    %7D)%0A    .then(function(incidents) %7B%0A      res.json(incidents);%0A    %7D);%0A%7D);%0A%0A
 // seque

Create Type path