It's quite absurd, but I've been grappling with a rather nonsensical code conundrum for days now.
I just can't seem to get the CSS and image to load on my Node.js server.
I've tried various solutions (like express.static, etc.), but nothing seems to do the trick.
Could you lend me a hand?
app.js
const express = require('express')
const app = express()
const port = 3000
app.listen(port, () => {
console.log(`app running on port ${port}`)
})
app.use((req, res, next) => {
res.sendFile(__dirname + "/index.html");
})
Index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Discover my newsletter to learn the basics of digital marketing and growth. Zennit is a Growth agency specialized in scraping and lead generation.">
<title>Growth Agency - specializing in scraping and leads generation</title>
<link rel="icon" type="image/png" href="assets/images/favicon.png" />
<link rel="stylesheet" href="./assets/css/web_version.css">
<link rel="stylesheet" href="./assets/css/mobile_version.css">
<link rel="stylesheet" href="./assets/css/tablet_version.css">
</head>
File structure
https://i.sstatic.net/OYk3q.png
Appreciate your assistance :)