-
Notifications
You must be signed in to change notification settings - Fork 7
/
app.js
47 lines (34 loc) · 1006 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
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* Fun • Messaging
*/
var express = require( 'express' )
, http = require( 'http' )
, app = express()
, events = require( 'events' )
, port = process.env.PORT || 3000;
/**
* App configuration
*/
app.configure( function() {
// Set port
app.set( 'port', port );
// Views dir
app.set( 'views', __dirname + '/app/server/views' );
// View engine
app.set( 'view engine', 'ejs' );
// Use
app.use( express.bodyParser() );
app.use( express.cookieParser() );
app.use( express.session({ secret: '3nj6K9lg5M0Yb7XU4' }) );
app.use( express.methodOverride() );
// Use less
app.use( require( 'less-middleware' )({ src: __dirname + '/app/public/' } ) );
// Static
app.use( express.static( __dirname + '/app/public' ) );
});
// Router
require( './app/server/router' )( app );
// Create server
http.createServer( app ).listen( app.get( 'port' ), function() {
console.log( 'Express server listening on port ' + app.get( 'port' ) );
});