-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
29 lines (23 loc) · 785 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')
, fs = require('fs')
, path = require('path');
var app = express();
var db = require('dirty')('bookmarks.db');
app.configure(function(){
app.set('port', process.env.PORT || 3001);
app.set('views', __dirname + '/app/views');
app.set('view engine', 'ejs');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(__dirname, '/public')));
});
// Bootstrap controllers
var controllers_path = __dirname + '/app/controllers'
, controller_files = fs.readdirSync(controllers_path);
controller_files.forEach(function (file) {
require(controllers_path+'/'+file)(app, db);
});
app.listen(app.get('port'))