-
Notifications
You must be signed in to change notification settings - Fork 33
/
app.js
34 lines (24 loc) · 835 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
30
31
32
33
34
// Load app dependencies
var express = require("express"),
mongoose = require("mongoose"),
http = require("http");
var app = express();
// Configure: bodyParser to parse JSON data
// methodOverride toimplement custom HTTP methods
// router to create custom routes
app.configure(function(){
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.static('./public'));
app.use(app.router);
});
app.configure('production', function(){
app.use(express.errorHandler());
});
// Sample routes are in separate modules to keep code clean
routes = require('./routes/router')(app);
// Conect to the MongoDB pictures database
mongoose.connect('mongodb://localhost/pictures_database');
// Start the server
http.createServer(app).listen(8080);
console.log("Server runnig at http://localhost:8080")