Commit 5c8dd661936685984a8ebd54a571d8ef008bcbbb
1 parent
084bd69ab6
Exists in
master
Set up index.js correctly for crime api to work
Showing 1 changed file with 4 additions and 4 deletions Side-by-side Diff
index.js
View file @
5c8dd66
1 | 1 | var express = require('express'); |
2 | +var crime = require('./routes/crime'); | |
2 | 3 | |
4 | + | |
3 | 5 | var app = express(); |
4 | -var app = require('/crime'); | |
5 | 6 | |
6 | 7 | app.set('port', (process.env.PORT || 5000)); |
7 | 8 | |
8 | -app.use(express.static(__dirname + '/public')); | |
9 | +app.use(express.static(__dirname + '../public')); | |
9 | 10 | |
10 | 11 | // views is directory for all template files |
11 | 12 | app.set('views', __dirname + '/views'); |
... | ... | @@ -19,7 +20,7 @@ |
19 | 20 | response.render('pages/landing'); |
20 | 21 | }); |
21 | 22 | |
22 | -app.get('/crime', crime.index); | |
23 | +app.get('/api', crime.view); | |
23 | 24 | |
24 | 25 | app.listen(app.get('port'), function() { |
25 | 26 | console.log('Node app is running on port', app.get('port')); |