Last active
August 29, 2015 14:22
-
-
Save cadecairos/881bf337ec4282adf836 to your computer and use it in GitHub Desktop.
route configuration example
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
var dataHandler = require('./dataHandler'); | |
var prerequisites = require('./prerequisites'); | |
exports = { | |
path: '/data', | |
method: 'get', | |
handler: dataHandler, | |
config: { | |
pre: [ | |
prerequisites.doSomething | |
] | |
} | |
}; |
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
var Lab = require('lab'), | |
lab = exports.lab = Lab.script(), | |
experiment = lab.experiment, | |
test = lab.test, | |
expect = require('code').expect; | |
experiment('Data Route', function() { | |
test('/data is configured as expected', function(done) { | |
var dataRoute = require('dataRoute.js'); | |
expect(dataRoute).to.be.an.object(); | |
expect(dataRoute.path).to.be.equal('/data'); | |
expect(dataRoute.method).to.equal('get'); | |
expect(dataRoute.handler).to.be.a.function(); | |
expect(dataRoute.config.pre).to.be.an.array(); | |
expect(dataRoute.config.pre.length).to.be.equal(1); | |
expect(dataRoute.config.pre[0]).to.be.a.function(); | |
done(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment