Best approach to add NodeBB to MEAN stack
-
Hi,
I have built a site with MEAN.JS (hosted on my own AWS EC2 servers) & now require a forum/community engine.
Have just come across nodeBB which appears to be a full site. Wondering what you guys think would be the best approach here?
Options I see are
- separate site say community.mydomain.com (would have to achieve a single sign on from main & community sites)
- add nodeBB as a type of CRUD module (excuse my terminology, I'm a newbie!!)
Open to any other options.
Thanks in advance
Todd
-
@tango first option is pretty much the only option
-
@tango there's another option: session sharing. There's a plugin for that, too. Just Google it
-
@Shard if I'm not mistaken the session sharing plugin allows you to create users in YOUR application and then share them into nodebb. I'm not sure about the OP but I'm working on the reverse solution. Given the great user management/profile system in nodebb, I want to leverage that and then just share that user into my application.
There's a jwt plugin that should expose a jwt which can then be used in a non-nodebb app. Unfortunately it isn't in acp and it looks like it isn't up to date. It doesn't show up after being activated and the dev log reports that the plugin may not work with the current version of nodebb.
I'm going to spend a little time trying to get it updated. I think there's a lot of value in this because of how robust the entire user system is in nodebb.
-
So it turns out that the JWT plugin works, it's just missing a dependency. The package.conf needs nconf installed. Once it's there the plugin starts up as expected.
From there it's very simple. Just browse to yourforum.com/api/jwt and you'll get the token if you're logged in, or you'll be redirected to the login page if you're not. Write a bit of code in your site to consume this from an ajax call and save it locally for some period of time. I suppose you could get it on each load but that seems wasteful. Cache it in local storage and the user is now logged in on your site as well.
-
@damian that plugin probably needs the config that NodeBB uses which means it needs to require the same nconf. That's why it's not in the package.json
It should just automatically work with NodeBB's nconf package unless you're npm linking it
-
@damian you can edit it to use
require.main.require
for requiring nconf and then submit a PR to the plugin's GitHub. Open an issue about it, too.Can you link the plugin so I can look at it?
-
Actually i'm beginner for Mean Stack, and i got an idea regarding this topic thank you all.....