hapi-405-routes
Version:
Allows 405 'Method Not Allowed' responses for hapi routes
86 lines (84 loc) • 2.06 kB
JavaScript
'use strict';
module.exports = []
.concat({
path: '/pigs',
method: 'GET',
config: {
pre: [
{
method: 'farm.retrieveAllPigs()',
assign: 'pigs'
}
]
},
handler: function (request, reply) {
return reply(request.pre.pigs);
}
})
.concat({
path: '/goats',
method: 'GET',
config: {
pre: [
{
method: 'farm.retrieveAllGoats()',
assign: 'goats'
}
]
},
handler: function (request, reply) {
return reply(request.pre.goats);
}
})
.concat({
path: '/goats',
method: 'POST',
config: {
pre: [
{
method: 'farm.busyGoats(payload)',
assign: 'babyGoat'
}
]
},
handler: function (request, reply) {
return reply(request.pre.babyGoat);
}
})
.concat({
path: '/goats/{goatId}',
method: 'GET',
config: {
pre: [
{
method: 'farm.retrieveSingleGoat(params.goatId)',
assign: 'goats'
}
]
},
handler: function (request, reply) {
return reply(request.pre.goats);
}
})
.concat({
path: '/goats/{goatId}',
method: 'DELETE',
config: {
pre: [
{
method: 'farm.goatFallsDownGiantScaryPitAndDiesTragically(params.goatId)',
assign: 'byeByeGoat'
}
]
},
handler: function (request, reply) {
return reply();
}
})
.concat({
path: '/tenant',
method: 'GET',
handler: function (request, reply) {
return reply(request.tenant());
}
});