Skip to content

Instantly share code, notes, and snippets.

@icodeforlove
Created July 17, 2014 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icodeforlove/c77de1893f573c2f2bc5 to your computer and use it in GitHub Desktop.
Save icodeforlove/c77de1893f573c2f2bc5 to your computer and use it in GitHub Desktop.
hapi-routes.js
// routes/products.js
module.exports = [
{
method: 'GET',
path: '/products',
config: {
validate: {
query: {
name: Joi.string().required(),
name2: Joi.string().required()
}
},
handler: function (request, reply) {
reply('test');
}
}
}
];
// routes/index.js
module.exports = [
require('./products')
];
// server.js
server.route(Array.prototype.concat.apply([], require('./routes')));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment