forked from eclipse-vertx/vert.x
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request eclipse-vertx#133 from nelsonsilva/commonjs
Added suport for CommonJS modules
- Loading branch information
Showing
5 changed files
with
118 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = function(req) { | ||
req.response.end("<html><body><h1>Hello from vert.x using CommonJS!</h1></body></html>"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
var Server, handler; | ||
|
||
Server = require('./server'); | ||
handler = require('./handler'); | ||
|
||
server = new Server(8080, 'localhost'); | ||
server.use(handler); | ||
server.start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
vertx=require('vertx'); | ||
|
||
module.exports = function(port, host){ | ||
var server = vertx.createHttpServer(); | ||
|
||
this.use = function(handler){ | ||
server.requestHandler(handler); | ||
}; | ||
|
||
this.start = function() { | ||
server.listen(port, host); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters