@sebastián-cisneros In static:api.routes, you'll want to call controllerHelpers.setupAPIRoute to mount the route to the appropriate /api/v3/plugins mount point.
You can see an example of how we do it in the quickstart plugin
Im currently using the bellow but it seems that .url is not verry reliable as even if the user dosent set it correctly the site just works anyway. Does Nodebb have a function somewhere i cant find?
var siteConfig = module.parent.require('../config.json');
siteConfig.url
You can use the nconf
dependency (to be listed as peerDependency
).
var nconf = require("nconf");
nconf.get("url")
However, it's just as unreliable; There is no current solution to save the user from mis-configured url
property. I get issues/questions regarding this on a regular basis.
@frissdiegurke im new to node in general is their not something in express or node have something similar to PHP's $_SERVER['HTTP_HOST']
?
@lewismcmahon There's no way to know what the full url is besides what's presented in config.json
, since multiple URLs can point to the same NodeBB.
The nconf
solution is the easiest.