CoreID/app/controllers/Home.controller.js
2020-05-03 20:16:54 -05:00

36 lines
907 B
JavaScript

const Controller = require('libflitter/controller/Controller')
/*
* Home Controller
* -------------------------------------------------------------
* Controller for the main homepage of this Flitter app. Methods here
* are used as handlers for routes specified in the route files.
*/
class Home extends Controller {
static get services() {
return [...super.services, 'Vue']
}
/*
* Serve the main welcome page.
*/
welcome(req, res){
/*
* Return the welcome view.
* The page() method is added by Flitter and passes some
* helpful contextual data to the view as well.
*/
return res.page('welcome', {
user: req.user,
...this.Vue.data(),
})
}
async tmpl(req, res) {
return res.page('tmpl', {...this.Vue.data(), ...this.Vue.session(req)})
}
}
module.exports = Home