Skip to content

Commit

Permalink
Add example of middleware usage
Browse files Browse the repository at this point in the history
  • Loading branch information
tedeh committed Sep 21, 2013
1 parent a045ab0 commit 6e36da6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions examples/middleware/server.js
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,15 @@
var jayson = require(__dirname + '/../..');
var connect = require('connect');
var app = connect();

var server = jayson.server({
add: function(a, b, callback) {
callback(null, a + b);
}
});

// parse request body before the jayson middleware
app.use(connect.bodyParser());
app.use(server.middleware());

app.listen(3000);

0 comments on commit 6e36da6

Please sign in to comment.