Why I get No such a file index.html error
My Folder Structure
here is my Code in server.js.
const PORT = process.env.PORT || 8000
const express = require('express');
const path = require('path')
const http = require('http');
const cors = require('cors');
const app = require('./app.js');
const planetsRouter = require('./routers/planets/planet.router')
const { loadPlanetsData } = require('./models/planets.model')
const server = http.createServer(app)
app.use(cors({ origin: 'http://localhost:3000' }))
app.use(express.json())
app.use(express.static(path.join(__dirname, '..', 'public')))
app.get('/', (req, res) => {
console.log('Res', req)
res.sendFile(path.join(__dirname, '..', 'public', 'index.html'))
})
app.use(planetsRouter)
async function startServer () {
await loadPlanetsData()
server.listen(PORT, () => {
console.log(`Listening on ${PORT}...`)
})
}
startServer()
I got this error Error: ENOENT: no such file or directory, stat 'C:\Users\kullanıcı\Desktop\Node Js\24-Nasa-Project\server\public\index.html'
This is server.js



