-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
36 lines (29 loc) · 943 Bytes
/
server.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
/**
* A fictitious movie recommendation application
*
* @author Kenny Kaye <[email protected]>
*/
'use strict';
var express = require('express');
var mongoose = require('mongoose');
var morgan = require('morgan');
var tools = require('./tools/index');
var controllers = require('./app/controllers/index');
var app = express();
mongoose.connect('mongodb://localhost/webfilmz');
// Mount middleware
app.use(morgan('dev'));
// Default routes
app.get('/', function (req, res) {
res.sendFile(__dirname + '/public/index.html');
});
// Display routes
app.get('/movies', controllers.movies.list);
app.get('/recommendations/:userId', controllers.recommendations.list);
// Tools routes
app.get('/tools/import-data', tools.importData);
app.get('/tools/build-comparison', tools.buildComparison);
// Listen on port
app.listen('8337', function () {
console.log('Webfilmz Server Connected at http://127.0.0.1:8337');
});