Plugin/Questions To get started
-
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.
-
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 thetest
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 asgrey
. 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. -