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.
 
 
 
 

54 lines
1.2 KiB

// welcome.js
// Copyright (C) 2021 Digital Telepresence, LLC
// License: Apache-2.0
'use strict';
const DTP_COMPONENT_NAME = 'welcome';
const express = require('express');
const { SiteController/*, SiteError */ } = require('../../lib/site-lib');
class WelcomeController extends SiteController {
constructor (dtp) {
super(dtp, DTP_COMPONENT_NAME);
}
async start ( ) {
const { limiter: limiterService } = this.dtp.services;
const welcomeLimiter = limiterService.create(limiterService.config.welcome);
const router = express.Router();
this.dtp.app.use('/welcome', welcomeLimiter, router);
router.get('/signup', this.getSignupView.bind(this));
router.get('/login', this.getLoginView.bind(this));
router.get('/', this.getHomeView.bind(this));
return router;
}
async getSignupView (req, res) {
res.render('welcome/signup');
}
async getLoginView (req, res) {
res.locals.loginResult = req.session.loginResult;
res.render('welcome/login');
}
async getHomeView (req, res, next) {
try {
res.render('welcome/index');
} catch (error) {
return next(error);
}
}
}
module.exports = async (dtp) => {
let controller = new WelcomeController(dtp);
return controller;
};