Generic middleware/plugin framework inspired by express.js's .use()