hello everyone!
i faced an error that i don’t understand and i need your help to fix it please.this are the tests that i have to pass:
// running tests
Pug should be a dependency. (Test timed out)
View engine should be Pug. (Test timed out)
Use the correct ExpressJS method to render the index page from the response.
Pug should be working.
// tests completed
this is my code:
‘use strict’;
require(‘dotenv’).config();
const express = require(‘express’);
const app = express();
app.engine(‘pug’, require(‘pug’).__express);
app.set(‘views’, path.join(__dirname, ‘views’));
//app.use(express.static(path.join(__dirname, ‘public’)));
app.set(‘view engine’, ‘pug’);
app.route(‘/’).get((req, res) => {
// Change the response to render the Pug template
res.render(process.cwd() + ‘/views/pug’);
});
and this is the error:
Error: Failed to lookup view “/home/runner/boilerplate-mochachai-1/views/pug” in views directory “/home/runner/boilerplate-mochachai-1/views”
Your project link(s)
solution: boilerplate-mochachai-1 - Node.js Repl - Replit
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36