fixed layout path

This commit is contained in:
bill bittner 2018-07-02 18:22:06 -07:00
parent f760346265
commit 67b5887ba5
4 changed files with 13 additions and 12 deletions

View file

@ -16,7 +16,6 @@ checkForConfig('siteConfig');
const express = require('express'); const express = require('express');
const bodyParser = require('body-parser'); const bodyParser = require('body-parser');
const expressHandlebars = require('express-handlebars'); const expressHandlebars = require('express-handlebars');
const Handlebars = require('handlebars');
const helmet = require('helmet'); const helmet = require('helmet');
const cookieSession = require('cookie-session'); const cookieSession = require('cookie-session');
const http = require('http'); const http = require('http');
@ -81,11 +80,13 @@ function Server () {
app.use(speechPassport.session()); app.use(speechPassport.session());
// configure handlebars & register it with express app // configure handlebars & register it with express app
const hbs = expressHandlebars.create({ const viewsPath = Path.resolve(process.cwd(), 'node_modules/spee.ch/server/views');
app.engine('handlebars', expressHandlebars({
defaultLayout: 'embed', defaultLayout: 'embed',
handlebars : Handlebars, partialsDir: Path.join(viewsPath, '/partials'),
}); layoutsDir: Path.join(viewsPath, '/layouts')
app.engine('handlebars', hbs.engine); }));
app.set('views', viewsPath);
app.set('view engine', 'handlebars'); app.set('view engine', 'handlebars');
// set the routes on the app // set the routes on the app

View file

@ -4,7 +4,7 @@ const sendVideoEmbedPage = ({ params }, res) => {
const claimId = params.claimId; const claimId = params.claimId;
const name = params.name; const name = params.name;
// get and render the content // get and render the content
res.status(200).render('embed', { layout: 'embed', host, claimId, name }); res.status(200).render('embed', { host, claimId, name });
}; };
module.exports = sendVideoEmbedPage; module.exports = sendVideoEmbedPage;

View file

@ -1 +1 @@
<video width="100%" controls src="{{host}}/{{claimId}}/{{name}}.mp4" type="video/mp4"></video> <video width="100%" controls src="{{host}}/asset/{{name}}/{{claimId}}" type="video/mp4"></video>