forked from carlosazaustre/node-api-rest-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
29 lines (24 loc) · 700 Bytes
/
app.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
var express = require("express"),
app = express(),
http = require("http"),
server = http.createServer(app),
mongoose = require('mongoose');
app.configure(function () {
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
});
app.get('/', function(req, res) {
res.send("Hello world!");
});
routes = require('./routes/tvshows')(app);
mongoose.connect('mongodb://localhost/tvshows', function(err, res) {
if(err) {
console.log('ERROR: connecting to Database. ' + err);
} else {
console.log('Connected to Database');
}
});
server.listen(3000, function() {
console.log("Node server running on http://localhost:3000");
});