/**
* @module libflitter/templates/middleware
*/
/**
* Get the contents of a new middleware definition file with the specified class name.
* @param {string} name - the name of the Middleware's class
* @returns {string}
*/
module.exports = exports = (name) => {
return `const Middleware = require('libflitter/middleware/Middleware')
/*
* ${name} Middleware
* -------------------------------------------------------------
* Put some description here!
*/
class ${name} extends Middleware {
/*
* Run the middleware test.
* This method is required by all Flitter middleware.
* It should either call the next function in the stack,
* or it should handle the response accordingly.
*/
async test(req, res, next, args = {}){
// Do stuff here
/*
* Call the next function in the stack.
*/
next()
}
}
module.exports = exports = ${name}`
}