Hapi jobs plugin for the Screwdriver API
const Hapi = require('hapi');
const server = new Hapi.Server();
const jobsPlugin = require('./');
server.connection({ port: 3000 });
server.register({
register: jobsPlugin,
options: {}
}, () => {
server.start((err) => {
if (err) {
throw err;
}
console.log('Server running at:', server.info.uri);
});
});
GET /jobs/{id}
PUT /jobs/{id}
Arguments:
state
- Current state of the job. Could beENABLED
orDISABLED
.
Example payload:
{
"state": "ENABLED"
}
The server supplies factories to plugins in the form of server app values:
// handler jobsPlugin.js
handler: (request, reply) => {
const factory = request.server.app.jobFactory;
// ...
}