A web application allowing people to create an account, configure a profile, and share a list of URLs on that profile.
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.
 
 
 
 

52 lines
1.2 KiB

// home.js
// Copyright (C) 2021 Digital Telepresence, LLC
// License: Apache-2.0
'use strict';
const DTP_COMPONENT_NAME = 'home';
const express = require('express');
const { SiteController } = require('../../lib/site-lib');
class HomeController extends SiteController {
constructor (dtp) {
super(dtp, DTP_COMPONENT_NAME);
}
async start ( ) {
const { dtp } = this;
const { limiter: limiterService } = dtp.services;
const router = express.Router();
dtp.app.use('/', router);
router.use(async (req, res, next) => {
res.locals.currentView = 'home';
return next();
});
router.get('/',
limiterService.create(limiterService.config.home.getHome),
this.getHome.bind(this),
);
}
async getHome (req, res, next) {
const { gabTV: gabTvService } = this.dtp.services;
try {
res.locals.pagination = this.getPaginationParameters(req, 20);
res.locals.gabTvChannel = await gabTvService.getChannelEpisodes('mrjoeprich');
res.render('index');
} catch (error) {
return next(error);
}
}
}
module.exports = async (dtp) => {
let controller = new HomeController(dtp);
return controller;
};