Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

195
Views
Why Express is not rendering HTML?

I'm using express to create my website but express doesn't render my HTML file, here is the difference;

Should seem like

seem like

I get this in console-nothing more in bottom (second picture)

enter image description here

I've uploaded correctly to cloud but it's not rendering though when I open it with Live Server, I got what I want. Please help.

server.js

//----------[ Importing Modules & Files ]---------\\
  
import express from 'express';
import cookies from 'cookies';
import engines from 'consolidate';
import path from 'path';
import bodyParser from 'body-parser';
import methodOverride from 'method-override';

import authRoutes from './routes/authRoutes.js';
import dashboardRoutes from './routes/dashboardRoutes.js';
import { validateUser, updateUser, updateGuilds } from './modules/middleware.js';

const app = express();
const __dirname = path.resolve(path.dirname(''));
let notifier;

//----------[ Export the Client ]---------\\

export default client => {
  ['sessions'].forEach(async module => {
    (await import(`./modules/${module}.js`)).default(client);
  });
}

//----------[ App Functions ]---------\\

app.set('assets', `${__dirname}/dashboard/views`);
app.set('views', `${__dirname}/dashboard/views`);
app.set('view engine', 'html');

app.engine('html', engines.mustache);

app.use(express.static(`${__dirname}/dashboard/views`));
app.use(express.static(`${__dirname}/dashboard/assets/images`));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(methodOverride('_method'));
app.use(cookies.express('c56ZVbTSsVMGD', 'E9Ej63wZN9BLD', 'v8fKf8QdzuPCf'));

app.locals.basedir = `${__dirname}/assets`;

app.use('/',
  authRoutes,
  dashboardRoutes,
  updateUser,
  updateGuilds,
  validateUser,
);

//----------[ 404 Error ]---------\\

app.all('*', (req, res) => res.sendFile('errors/404'));

//----------[ Listen & Log ]---------\\

const port = process.env.PORT || 8001;

app.listen(port, () => {
  console.log(`[✅] Watching server live on port ${port}`);
});

(i can't upload HTML because it's too big but there's no HTML issue)

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!