Hapi events plugin for the Screwdriver API
const Hapi = require('hapi');
const server = new Hapi.Server();
const eventsPlugin = require('./');
server.connection({ port: 3000 });
server.register({
register: eventsPlugin,
options: {}
}, () => {
server.start((err) => {
if (err) {
throw err;
}
console.log('Server running at:', server.info.uri);
});
});
GET /events/{id}
GET /events/{id}/builds
The server supplies factories to plugins in the form of server app values:
// handler eventsPlugin.js
handler: (request, reply) => {
const factory = request.server.app.eventFactory;
// ...
}