Skip to content

Commit d5ddebe

Browse files
docs: clarify that public folder requires node_helper.js (#362)
1 parent 5f844c7 commit d5ddebe

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

module-development/introduction.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,13 @@ same time.
6565
by the node script. The node helper and module script can communicate with
6666
each other using an integrated socket system.
6767
- **modulename/public** - Any files in this folder can be accessed via the
68-
browser on `/modulename/filename.ext`.
68+
browser on `/modulename/filename.ext`. **Note:** This requires the module to
69+
have a `node_helper.js` file. If your module doesn't need a node helper for
70+
anything else, an empty stub is enough:
71+
```js
72+
const NodeHelper = require("node_helper");
73+
module.exports = NodeHelper.create({});
74+
```
6975
- **modulename/anyfileorfolder** Any other file or folder in the module folder
7076
can be used by the core module script. For example:
7177
_modulename/css/modulename.css_ would be a good path for your additional

module-development/node-helper.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ created:
5757
this.expressApp.use("/" + this.name, express.static(this.path + "/public"));
5858
```
5959

60+
This means files in the `public` folder are only served if the module has a
61+
`node_helper.js`. See also the
62+
[module structure](introduction.md#files) documentation.
63+
6064
### `this.io`
6165

6266
**Socket IO Instance**

0 commit comments

Comments
 (0)