Answer the question
In order to leave comments, you need to log in
How to enable css?
Hello. I am learning to create simple http servers on Node. Faced a problem. Here is the code on the node:
app.get('/', (req, res) => {
res.sendFile(__dirname + '/client/dist/index.html');
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="./css/app.css">
<title>Testing</title>
</head>
<body>
<div class="container">
<h1>Hello world!</h1>
</div>
<script src = "./js/app.js"></script>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
Issue resolved. If someone also faces such problem then here is expressjs.com/en/starter/static-files.html
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question