-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
29 lines (23 loc) · 925 Bytes
/
index.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');
// because drakov sux
var drakovMiddleware = require('./node_modules/drakov/index').middleware;
var serveStatic = require('serve-static');
var app = express();
// Serve up public/ftp folder
var serve = serveStatic(__dirname + '/public', {'index': ['index.html', 'index.htm']})
app.use(serve); // need to have a body parser for the middleware to work
drakovOptions = {
sourceFiles: 'docs/**/*.md',
serverPort: 4007,
method: ['DELETE','OPTIONS','PUT','POST','GET']
};
// currently need to initialise the middleware asynchronously due to protagonist parse in async
drakovMiddleware.init(app, drakovOptions, function(err, middlewareFunction) {
if (err) {
throw err;
}
app.use(middlewareFunction);
app.listen(drakovOptions.serverPort, function() {
console.log('server started with Drakov middleware on port ' + drakovOptions.serverPort);
});
});