-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
74 lines (58 loc) · 1.74 KB
/
Copy pathmain.js
File metadata and controls
74 lines (58 loc) · 1.74 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
const
express = require("express"),
mongoose = require('mongoose'),
path = require("path"),
http = require('http'),
fs = require('fs'),
url = require('url')
;
var expressMarkdown = function(dir) {
return require('express-markdown')({
// directory where markdown files are stored
// required
directory: dir,
// view to use for rendering markdown file
// optional
// default is undefined, no view
// view: 'foo',
// name of markdown variable passed in the context when rendering
// optional
// default 'markdown'
// variable: 'bar'
});
}
// Database
mongoose.connect('mongodb://localhost/kitchensink');
// Init schemas
var schemas = require('./schemas');
var app = new express();
// LOG File Config
var logFile = fs.createWriteStream('./logs/main.log', {
flags: 'a+'
}); //use {flags: 'w'} to open in write mode
app.configure('development', function(){
app.use(express.logger({
stream: logFile
}));
app.use(express.errorHandler({
dumpExceptions: true,
showStack: true
}));
app.use('/static', express.directory('static'));
app.use('/src', expressMarkdown(__dirname));
app.use('/src', express.directory(__dirname));
app.use('/src', express.static(__dirname));
app.use('/doc', expressMarkdown(__dirname+'/doc'));
app.use('/doc', express.directory(__dirname+'/doc'));
app.use('/doc', express.static(__dirname+'/doc'));
});
app.configure(function(){
app.use('/static', express.static('static'));
});
app.use(
express.vhost('admin.*', require('./apps/admin/server').app)
);
app.use(
express.vhost('www.*', require('./apps/public/server').app)
);
app.listen(8080);