Advanced Node and Express - Set up a Template Engine

Tell us what’s happening:

When entering the URL of a working project to run the tests, the following error is generated in the browser console: “DataCloneError: Error executing ‘postMessage’ on ‘Window’: The URL object could not be cloned.”

The repository with the code is as follows: https://github.com/adrielcaro25/Set-up-a-Template-Engine

A URL for the project deployed on Vercel is: https://set-up-a-template-engine.vercel.app/

Please, your guidance.

Your code so far

'use strict';
require('dotenv').config();
const express = require('express');
const myDB = require('./connection');
const fccTesting = require('./freeCodeCamp/fcctesting.js');

const app = express();

app.set('view engine', 'pug');
app.set('views', './views/pug');
fccTesting(app); // For fCC testing purposes
app.use('/public', express.static(process.cwd() + '/public'));
app.use(express.json());
app.use(express.urlencoded({ extended: true }));

app.route('/').get((req, res) => {
res.render('index');
});

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

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0

Challenge Information:

Advanced Node and Express - Set up a Template Engine

I believe I know the source of the bug. It’s a similar one to one I noticed with a different backend challenge where an object (in this case the url provided), isn’t getting properly parsed because it’s an object with properties. I have a fix in the works for it.

1 Like

Okay, thank you very much. I just need to finish that section now that I’ve already obtained the certification.