Can I add nodebb to express based website?
-
Hi,
I am fairly new to node.js and am writing a games oriented server that uses the 'express' node.js module to serve static content, and websockets for game management. I am also using MongoDB for DB support.
Is it possible to add a nodebb forum to such a setup, eg: under the https://mywebsite/forums URL? I don't need to share the login/user system or anything too clever, I'm quite happy with the forum behaving as if it was a completely different site for now.
I already have various 'services' that attach themselves to the express app using, for example...
app.get("/.well-known/webfinger", (req, res)=>{
});...for handling webfinger requests, and was hoping I could do something similar for nodebb requests, eg:
app.get("/forums", (req, res)={
// awesomely simple code here, eg:
nodebb.processRequest(req, res);
});I doubt it's that simple, but that hopefully describes what I want to achieve fairly well. I have no idea what the 'industry standard' way to do this sort of thing is...
Bye!
Mark -
@marksibly I would recommend doing it through the reverse proxy (nginx caddy or whatever you use), and not to mediate through the node.js
Caddyfile example (https://caddyserver.com) :mywebsite.com { reverse_proxy /forum/* localhost:4567 # nodebb default port reverse_proxy localgost:3000 # your node.js app port }
Then set the address in the config.json file of the nodebb:
{ "url": "https://mywebsite.com/forum/", ... }
and then run
./nodebb build
./nodebb restart
And the forum will be available at https://mywebsite.com/forum/ (be sure to keep the / at the end)