Ask coding questions

← Back to all posts
My Node.js website's stylesheet = null
RixTheTyrunt

Hello, I didn't found the styleshet, while I defined the stylesheet in style.css file, but when I try to find it in my website, it shows monospaced element like this:

Can you help?

Voters
RixTheTyrunt
Comments
hotnewtop
RixTheTyrunt

Maybe making style attributes will work?

RixTheTyrunt

Yes! Finally!

Coder100

you have a static folder that's correct
but you need to host that static folder.

add that after the const app = express();

Also, have you considered using res.sendFile() instead of copying and pasting your HTML files??

RixTheTyrunt

Still nothing.

Coder100

you didn't add the code lol @RixTheTyrunt

RixTheTyrunt

I actually added, but it didn't work.

RixTheTyrunt

I tried res.sendFile("https://nodejam.rixthetyrunt.repl.co/index.html") but I didn't get anything...

Coder100

no that's not what I meant

now make an index.html in the root directory (not in any folders.)
@RixTheTyrunt

RixTheTyrunt

What is __dirname?

Coder100

the current director you are in @RixTheTyrunt

ch1ck3n

you should put it in /static

RixTheTyrunt

I will put the stylesheet in the folder named static. OK?

RixTheTyrunt

Do I understand you?

RixTheTyrunt

Still no stylesheet. Yet.

ch1ck3n

@RixTheTyrunt you dont fricking need to spam my notification to get your point across