-
Notifications
You must be signed in to change notification settings - Fork 36
Using Node.js modules
Phil Beauvoir edited this page Feb 18, 2024
·
11 revisions
Since jArchi 1.6 you can access your own modules or other Node.js modules
- In your jArchi scripts folder create a sub-folder named
node_modules
. This is the parent folder for node modules. - In the
node_modules
folder create a sub-folder namedhelloworld
. This will be the folder for your module. - In the
helloworld
folder create a file calledindex.js
containing this code:
exports.sayHelloWorld = function() {
window.alert("Hello World!");
}
- In your jArchi scripts folder create a file called
test_module.ajs
containing this code:
const speaker = require("helloworld");
speaker.sayHelloWorld();
- Run the
test_module.ajs
script
If you value and use Archi please consider making a donation. Thanks!