Hey all,
Looks like i can’t get any of the Advanced Node and Express challenges to pass. I added pug as dependancy and get pug to render the view. Page updates to "Looks like this page is being rendered from Pug into HTML! " but none of the challenges pass. Answers submitted via glitch, maybe there is something wrong with my code? https://glitch.com/edit/#!/uncovered-chatter .
Same problem here! I think it’s a bug.
Just wrote something in the Contributors chat room to let them know.
I opened a github issue here: https://github.com/freeCodeCamp/freeCodeCamp/issues/17618
Add this code to the top of your server.js file and try the tests again:
const cors = require('cors');
app.use(cors());
Please let me know if it works!
Credit to hasnass for the info: Advanced Node and Express Challenges - missing stuff
1 Like
I’ve added
const cors = require('cors');
app.use(cors());
But am not passing “Advanced Node and Express - Use a Template Engine’s Powers”.
I looked at the test source
{
"name": "Advanced Node and Express",
"order": 3,
"time": "5 hours",
"helpRoom": "Help",
"challenges": [
{
"id": "5895f700f9fc0f352b528e63",
"title": "Set up a Template Engine",
"description": [
"As a reminder, this project is being built upon the following starter project on <a href='https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-advancednode/'>Glitch</a>, or cloned from <a href='https://github.com/freeCodeCamp/boilerplate-advancednode/'>GitHub</a>.",
"A template engine enables you to use static template files (such as those written in <em>Pug</em>) in your app. At runtime, the template engine replaces variables in a template file with actual values which can be supplied by your server, and transforms the template into a static HTML file that is then sent to the client. This approach makes it easier to design an HTML page and allows for displaying of variables on the page without needing to make an API call from the client.",
"To set up <em>Pug</em> for use in your project, you will need to add it as a dependency first in your package.json. <code>\"pug\": \"^0.1.0\"</code>",
"Now to tell Node/Express to use the templating engine you will have to tell your express <b>app</b> to <b>set</b> 'pug' as the 'view-engine'. <code>app.set('view engine', 'pug')</code>",
"Lastly, you should change your response to the request for the index route to <code>res.render</code> with the path to the view <em>views/pug/index.pug</em>.",
"If all went as planned, you should refresh your apps home page and see a small message saying you're successfully rending the Pug from our Pug file! Submit your page when you think you've got it right."
],
"tests": [
{
"text": "Pug is a dependency",
This file has been truncated. show original
It appears that it is only looking for “Please login” as the pug-variable.
…
assert.match(data, /pug-variable("|’)>Please login/gi
…
That is rendering for me, but the test is not passing. Any suggestions?
Here is my glitch project: https://glitch.com/~courageous-hole
Thank you!