Created
February 18, 2014 18:12
-
-
Save nlf/9076445 to your computer and use it in GitHub Desktop.
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 Hapi = require('hapi'); | |
var Joi = require('joi'); | |
var server = new Hapi.Server('127.0.0.1', 3000); | |
server.route({ | |
method: 'GET', | |
path: '/{version}/something', | |
handler: function (request, reply) { | |
reply(request.params.version); | |
}, | |
config: { | |
validate: { | |
path: { | |
version: Joi.string().regex(/v[\d]+/) | |
} | |
} | |
} | |
}); | |
server.start(function () { | |
console.log('Server running at:', server.info.uri); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment