To anyone searching the same thing, I resolved the problem using the custom write-api hooks, I wasn't aware of:
Link Preview Image
nodebb-plugin-write-api/routes/v1/index.js at master ยท NodeBB/nodebb-plugin-write-api
A RESTful JSON-speaking API allowing you to write things to NodeBB - nodebb-plugin-write-api/routes/v1/index.js at master ยท NodeBB/nodebb-plugin-write-api
favicon
GitHub (github.com)
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.