So I'm working on a game and I chose nodeBB because of its customization ability and being in javascript (easy to edit and manipulate). I currently use the docker version to rollout nodebb with wordpress. Before I continue the docker version was pretty complicated to set up with lack of directions but I got it up and running.
I need to know if I did something a good or bad way. I currently have a restful api that has all the items in json format (over 3000 items). So essentially what I did was when nodebb is installed it reads that api and places them in public/items/ individually instead of all items being in one json file. I felt this was way faster then reading the entire json file for every single item.
I modified an extended version of a plugin that supported bbcodes (to lazy to write me own). I considered using mongoDB but the information doesn't change so i felt this was a utterly waste.
if (typeof (code) !== "undefined") {
let item_id = code;
const itemPath = path.join(__dirname, "../../../app/public/items/"+ item_id +".json");
try {
if (fs.existsSync(itemPath)) {
let rawItemData = fs.readFileSync(itemPath);
let itemData = JSON.parse(rawItemData.toString());
return `<img src="http://api.delteria.com/resource/${itemData.properties.icon}" alt="Avatar" class="avatar"><span class="extended-markdown-tooltip" data-toggle="tooltip" title="${itemData.properties.description}"><span style="color: ${getRarity(itemData.controllerProperties.rarity)};">${itemData.properties.itemName}</span></span>`;
}
} catch(err) {
console.error(err)
}
Here is the progress
Should I have done this differently?