/**
* @module libflitter/templates/controller
*/
/**
* Get the contents of a new controller file with the given class name.
* @param {string} name - the name of the Controller's class
* @returns {string}
*/
module.exports = exports = (name) => {
return `const Controller = require('libflitter/controller/Controller')
/*
* ${name} Controller
* -------------------------------------------------------------
* Put some description here!
*/
class ${name} extends Controller {
/*
* Serve the main page.
*/
main(req, res){
/*
* Return the main view.
* It must be passed the response.
* Parameters can be passed to the page method as an
* object as an optional second argument.
*/
return res.page('view_name')
}
}
module.exports = exports = ${name}`
}