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

added includemod example for javascript #5

Merged
merged 1 commit into from
Mar 11, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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");
}
});