question about staticDirs

General Discussion
  • hey, how exactly is the staticDirs within plugin.json implemented?

    Is it somehow possible to add a directory and dynamically add its files later, but as soon as they're available they should be accessible...

  • That should be how it works right now. The staticDirs property maps an alias (the object key) to the actual system path.

    For example:

    staticDirs: {
        "foo": "bar"
    }
    

    ... will map the route 127.0.0.1:4567/plugins/nodebb-theme-myplugin/foo to /path/to/nodebb/node_modules/nodebb-theme-myplugin/bar

    I believe I used express.static to route the directory, so any files added in after NodeBB has started should still be routed, since the parent directory was the one that was mounted.


Suggested Topics