• GNU/Linux

    So I've been using nodebb for a little while but never got into the coding of a plugin for it.

    I've been working on a side project for a while using nodejs, (I'm learning still.) but I have it working and writes to a mongodb for persistence. I am looking at making a new page for displaying that info. Can anyone help me with links or helpful hints on how to get started?

    I assume I'd need to do it in a plugin, any help would be appreciated thanks.

  • Community Rep

    Check out the kitchen-sink, it creates a new page here: https://github.com/NodeBB/nodebb-plugin-kitchen-sink/blob/master/lib/customRoutes.js

    In the renderSink function is where you would get the data you need from the database, then send it to the template, instead of the test object.

    The render function will replace the template strings in your template with the values in your data object. For example, if the data you passed it is { color: grey }, then putting {color} in your template with parse as grey. https://github.com/NodeBB/nodebb-plugin-kitchen-sink/blob/master/templates/demo.tpl The example shows an array and variable being parsed. You can also do some simple logic with templates too, check out some of the other plugins or the NodeBB docs.

  • GNU/Linux

    Thanks, yeah I wrote a game server rcon web socket bot, which stores all the player information, so got the just of using mongo update/inserts/find functionality just never made a plugin for nodebb so was kinda weird on how to start lol.

Suggested Topics

| |