Created
March 23, 2012 08:47
-
-
Save dhendo/2168516 to your computer and use it in GitHub Desktop.
webservice.js Test
This file contains hidden or 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.title = "Welcome to your webservice!"; | |
this.name = "demo api module"; | |
this.version = "0.1.0"; | |
this.endpoint = "http://localhost:8556"; | |
exports.echo = function(options, callback){ | |
callback(null, options.msg); | |
}; | |
exports.echo.description = "this is the echo method, it echos back your msg"; | |
exports.echo.schema = { | |
msg: { | |
type: 'string', | |
optional: false | |
} | |
}; | |
exports.ping = function(options, callback){ | |
setTimeout(function(){ | |
callback(null, 'pong'); | |
}, 2000); | |
} | |
exports.ping.description = "this is the ping method, it pongs back after a 2 second delay"; |
This file contains hidden or 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
var webservice = require('webservice'); | |
var demoModule = require('./demoModule.js'); | |
webservice.createServer(demoModule).listen(8556); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment