February 2019
Beginner
694 pages
18h 4m
English
Handlebars can be installed via npm as follows:
npm install hbs --save
Once Handlebars has been installed, all we need to do is add three lines to our application source file (app.ts), as follows:
import express from 'express';
let app = express();
import * as Index from './routes/Index';
import * as Login from './routes/Login';
import * as path from 'path';
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'hbs');
app.use('/', Index.router);
app.use('/', Login.router);
Here, we have added an import for the module named 'path'. The path module allows us to use several handy functions when working with directory pathnames. One of the variables exposed by the path module is the __dirname variable, which ...
Read now
Unlock full access