Ask coding questions

← Back to all posts
RossJames (271)

I have a problem with my code because i need to send a file of html, css, js to the client. at the moment, i can only send one file, the html.


abc3354 (209)

Hi !
You should add a path for all your client files

example for style.css

app.get('/client/styles.css', function(req, res){ // path you will access on the website
    res.sendFile(dirname + '/client/styles.css'); // real path of the file

A more convenient way is to use serve static
You will find example on the npm page, here

Replit helper here !
If you found my answer helpful, you can upvote it :)
If my post answers the question, mark it as the answer !

RyanRana (189)

I think you should combine all the files into one file with HTML, JS, and C++, I think this will work.