Answer the question
In order to leave comments, you need to log in
How to properly display html page in express.js?
hi
Customized express
const express = require('express');
const path = require('path')
const app = express();
app.get('/',(req,res) => {
res.status(200)
res.sendFile(path.join(__dirname, 'views', 'index.html'))
})
const PORT = process.env.PORT || 3000
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`)
}) ;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question