drakov
drakov copied to clipboard
Different behaviour while used as an expressjs middleware
The code I'm using is from the documentation:
// api.js
var express = require('express');
var drakov = require('drakov')
var drakovMiddleware = require('drakov').middleware;
var port = process.env.PORT || 3000;
var argv = {
sourceFiles: './api.md',
serverPort: port,
staticPaths: [
'static/',
],
stealthmode: false,
delay: 0,
drakovHeader: true,
public: true,
disableCORS: true
};
var app = express();
drakovMiddleware.init(app, argv, function(err, middlewareFunction) {
if (err) {
throw err;
}
app.use(middlewareFunction);
app.listen(argv.serverPort);
});
If I run the script from commandline node api.js
, no route would work but the static hosted one.
But, if I am using drakov -f api.md -p 3000
from CLI, all routes would work as expected.
Thanks for reporting @evanslify when I get a chance (possibly later this week) I will investigate