DTP Base provides a scalable and secure Node.js application development harness ready for production service.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

42 lines
890 B

// home.js
// Copyright (C) 2024 DTP Technologies, LLC
// All Rights Reserved
'use strict';
import { SiteController } from '../../lib/site-controller.js';
export default class HomeController extends SiteController {
static get name ( ) { return 'HomeController'; }
static get slug ( ) { return 'home'; }
constructor (dtp) {
super(dtp, HomeController.slug);
this.dtp = dtp;
}
async start ( ) {
const router = this.createRouter('/');
router.get('/', this.getHome.bind(this));
return router;
}
async getHome (req, res, next) {
try {
if (!req.user) {
return res.redirect('/welcome');
}
res.locals.currentView = 'home';
res.locals.pageDescription = 'DTP Base';
res.render('home');
} catch (error) {
this.log.error('failed to present the home view', { error });
return next(error);
}
}
}