I have a question regarding pure NodeJS as I am starting to learn the basic concepts.

My question is as following:

I have a simple WebPage

index.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" />
        <title>HomePage</title>
        <link  rel="stylesheet" type="text/css" href="./tailwind.css" />
    </head>
    <body>
        <div
            class="
                h-screen
                w-screen
                bg-gradient-to-r
                from-yellow-400
                via-red-500
                to-pink-500
                flex flex-col
                items-center
            "
        >
            <h1
                class="
                    flex
                    justify-center
                    items-center
                    m-10
                    bg-white bg-opacity-50
                    rounded
                    p-2
                    h-20
                    w-auto
                    text-white text-2xl
                "
            >
                Welcome to my HomePage
            </h1>
            <p class="m-2">
                This is my first Node JS Project. A simple Server-Side Webpage
            </p>
            <div
                class="
                    flex
                    justify-center
                    items-center
                    m-1
                    p-2
                    bg-white bg-opacity-50
                    rounded
                    h-auto
                    w-auto
                    text-white text-2xl
                "
            >
                <button
                    class="
                        flex
                        justify-center
                        items-center
                        m-1
                        p-2
                        bg-white bg-opacity-50
                        rounded
                        h-10
                        w-48
                        text-white text-lg
                    "
                    onclick="localhost:8080/about"
                >
                    About
                </button>
                <button
                    class="
                        flex
                        justify-center
                        items-center
                        m-1
                        p-2
                        bg-white bg-opacity-50
                        rounded
                        h-10
                        w-48
                        text-white text-lg
                    "
                    onclick="localhost:8080/contact"
                >
                    Contact Me
                </button>
            </div>
        </div>
    </body>
</html>

```

I have a tailwind.css file in the same directory. When I make a request to my NodeJS, I do get both index.html as well as tailwind.css.

My problem: Even though tailwind.css is delivered, I do not have the styling applied.

There are two versions of my NodeJS code. One that does work and another that doesn't.

Maybe you can explain to me why.

Correct code:

```
const url = require('url');
const fs = require('fs');
const path = require('path');

http
    .createServer(function (req, res) {
        let filePath = path.join(
            __dirname,
            '../public',
            req.url === '/' ? 'index.html' : req.url
        );
        let extname = path.extname(filePath);
        let contentType = 'text/html';

        switch (extname) {
            case '.js':
                contentType = 'text/javascript';
                break;
            case '.css':
                contentType = 'text/css';
                break;
            case '.json':
                contentType = 'application/json';
                break;
            case '.png':
                contentType = 'image/png';
                break;
            case '.jpg':
                contentType = 'image/jpg';
                break;
        }

         fs.readFile(filePath, (err, content)=> {
            if (err) throw err

            res.writeHead(200, {'Content-Type': contentType})
            res.write(content)
            res.end()
         })

    })
    .listen(8080);

```

wrong code:

```
const url = require('url');
const fs = require('fs');
const path = require('path');

http
    .createServer(function (req, res) {
        let filePath = path.join(
            __dirname,
            '../public',
            req.url === '/' ? 'index.html' : req.url
        );
        let extname = path.extname(filePath);
        let contentType = 'text/html';

         fs.readFile(filePath, (err, content)=> {
            if (err) throw err

            res.writeHead(200, {'Content-Type': contentType})
            res.write(content)
            res.end()
         })

    })
    .listen(8080);```

```