To anyone searching the same thing, I resolved the problem using the custom write-api hooks, I wasn't aware of:
https://github.com/NodeBB/nodebb-plugin-write-api/blob/master/routes/v1/index.js#L45
filter:plugin.write-api.routes
that gives you data, I used it in this way:
function(data, callback) {
var app = data.router;
var apiMiddleware = data.apiMiddleware;
var middleware = data.middleware;
var errorHandler = data.errorHandler;
app.post('/route', apiMiddleware.requireUser, function(req, res) {
// do stuff
});
callback(null, {
router: app
});
};
Obviously you should have nodebb-plugin-write-api installed.