Express page returns 'OK'

This express code:

const http = require('http');
const express = require('express');
const app = express();
const path = require(''path')

app.get("/", (request, response) => {
response.sendFile(path.join(__dirname + '/home.html'))
response.sendStatus(200);
});

app.listen(process.env.PORT);

does not give off any errors, but on the website, it returns ‘OK’. How can I solve this to display the home.html page?

You can drop the response.sendStatus(200);, the sendFile is enough (https://expressjs.com/en/api.html#res.sendFile)

1 Like

Thank you so much! It worked :slight_smile: