makemehapi
Version:
Self guided workshops to teach you about hapi.
28 lines (22 loc) • 540 B
JavaScript
var Hapi = require('hapi');
var Joi = require('joi');
var server = new Hapi.Server();
server.connection({
host: 'localhost',
port: Number(process.argv[2] || 8080)
});
server.route({
method: 'GET',
path: '/chickens/{breed}',
config: {
handler: function (request, reply) {
reply('You asked for the chicken ' + request.params.breed);
},
validate: {
params: {
breed: Joi.string().required()
}
}
}
});
server.start(function () {});