-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
48 lines (41 loc) · 1.21 KB
/
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
48
/**
* Module dependencies.
*/
var express = require('express');
var routes = require('./routes');
var parse = require('./routes/parse');
var http = require('http');
var marked = require('marked');
var path = require('path');
var logger = require('morgan');
var bodyParser = require('body-parser');
var methodOverride = require('method-override');
var app = express();
// Initialize marked
marked.setOptions({
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: false,
smartLists: true,
langPrefix: 'language-'
});
// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'pug');
app.use(logger('dev'));
app.use(bodyParser.urlencoded({ extended: false }))
app.use(methodOverride());
app.use(require('stylus').middleware(__dirname + '/public'));
app.use(express.static(path.join(__dirname, 'public')));
if ('development' === app.get('env')) {
var errorHandler = require('errorhandler');
app.use(errorHandler());
}
app.get('/', routes.index);
app.post('/parse', parse.parse(marked));
http.createServer(app).listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
});