Advanced Node and Express - Set up a Template Engine help me

Advanced Node and Express - Set up a Template Engine help me
0

#1


#2

Why are there 2 renders?

PS This is in the wrong category. It should be in HELP.


#3

Now why my test is not pass


#4

I set the view engine then why my test not pass
app.set(‘view-engine’, ‘pug’);


#5

Hi.
I’m not sure where you’re at with the exercise. I hope you were able to successfully complete it and move forward.

For anyone having seemingly the same trouble, “view engine” isn’t hyphenated according to the documentation found at this link:
https://expressjs.com/en/guide/using-template-engines.html


#6
'use strict';
//const path = require('path');
const express     = require('express');
const bodyParser  = require('body-parser');
const fccTesting  = require('./freeCodeCamp/fcctesting.js');
const pug = require('pug');
const app = express();

fccTesting(app); //For FCC testing purposes
app.use('/public', express.static(process.cwd() + '/public'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));

//set up a template engine
app.set('view engine','pug');

app.route('/')
.get((req, res) => {
  res.render(process.cwd() + '/views/pug/index', {title: 'Hello', message: 'Please login'});
});

app.listen(process.env.PORT || 3000, () => {
  console.log("Listening on port " + process.env.PORT);
});




#7

dont put screenshots on here dude. just paste the link to your project