diff --git a/src/modules/javascript/includemod/mods/com.acme~common-stuff~v1.0/bar.js b/src/modules/javascript/includemod/mods/com.acme~common-stuff~v1.0/bar.js new file mode 100644 index 00000000..59e0d743 --- /dev/null +++ b/src/modules/javascript/includemod/mods/com.acme~common-stuff~v1.0/bar.js @@ -0,0 +1,5 @@ +var sayHello = function(name) { + return "Hello " + name; +}; + +module.exports.sayHello = sayHello; diff --git a/src/modules/javascript/includemod/mods/com.acme~common-stuff~v1.0/mod.json b/src/modules/javascript/includemod/mods/com.acme~common-stuff~v1.0/mod.json new file mode 100644 index 00000000..0db3279e --- /dev/null +++ b/src/modules/javascript/includemod/mods/com.acme~common-stuff~v1.0/mod.json @@ -0,0 +1,3 @@ +{ + +} diff --git a/src/modules/javascript/includemod/mods/com.acme~common-stuff~v1.0/test.js b/src/modules/javascript/includemod/mods/com.acme~common-stuff~v1.0/test.js new file mode 100644 index 00000000..b616dc2b --- /dev/null +++ b/src/modules/javascript/includemod/mods/com.acme~common-stuff~v1.0/test.js @@ -0,0 +1,8 @@ +//Test if requiring bar lib works locally +var bar = require("./bar.js"); + +if (bar.sayHello("User") == "Hello User") { + console.log("requiring bar.js works"); +} else { + console.log("requiring bar.js didn't work"); +} diff --git a/src/modules/javascript/includemod/mods/com.acme~module1~v1.0/mod.json b/src/modules/javascript/includemod/mods/com.acme~module1~v1.0/mod.json new file mode 100644 index 00000000..2eaa1967 --- /dev/null +++ b/src/modules/javascript/includemod/mods/com.acme~module1~v1.0/mod.json @@ -0,0 +1,4 @@ +{ + "includes": "com.acme~common-stuff~v1.0", + "main": "run_module_1.js" +} diff --git a/src/modules/javascript/includemod/mods/com.acme~module1~v1.0/run_module_1.js b/src/modules/javascript/includemod/mods/com.acme~module1~v1.0/run_module_1.js new file mode 100644 index 00000000..999040c5 --- /dev/null +++ b/src/modules/javascript/includemod/mods/com.acme~module1~v1.0/run_module_1.js @@ -0,0 +1,15 @@ +var vertx = require('vertx'); +var console = require('vertx/console'); +var bar = require('bar.js'); + +var server = vertx.createHttpServer(); + +server.requestHandler(function(request) { + request.response.end(bar.sayHello("User")); +}); + +server.listen(8181, 'localhost', function(err) { + if (!err) { + console.log("Server listening on 8181"); + } +});