Skip to content

Commit

Permalink
add example file with some event listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
technoweenie committed Jan 18, 2010
1 parent 2c59320 commit 229e823
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions example.js
@@ -0,0 +1,24 @@
var sys = require('sys'),
api = require('./lib/api').create(),
PORT = 3456

api
.addListener('request', function(req, status) {
sys.puts(req.method + " " + req.url + ' => ' + status)
})

.addListener('locate', function(user, location) {
sys.puts("LOCATE " + user + ' => ' + location)
})

.addListener('list', function(location, users) {
sys.puts("LIST " + location + " => " + users.join(", "))
})

.addListener('track', function(user, location) {
sys.puts("TRACK " + user + " => " + location)
})

api.listen(PORT);

sys.puts("Starting Where's Waldo server on port " + PORT)

0 comments on commit 229e823

Please sign in to comment.