Skip to content
This repository has been archived by the owner on Aug 13, 2018. It is now read-only.

Commit

Permalink
Merge pull request #5 from CansaSCityShuffle/javascript-includemod
Browse files Browse the repository at this point in the history
added includemod example for javascript
  • Loading branch information
purplefox committed Mar 11, 2014
2 parents 6a48680 + 0b08670 commit dd7d111
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var sayHello = function(name) {
return "Hello " + name;
};

module.exports.sayHello = sayHello;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{

}
Original file line number Diff line number Diff line change
@@ -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");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"includes": "com.acme~common-stuff~v1.0",
"main": "run_module_1.js"
}
Original file line number Diff line number Diff line change
@@ -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");
}
});

0 comments on commit dd7d111

Please sign in to comment.