Answer the question
In order to leave comments, you need to log in
How to run a site on node.js?
Started the server on node express.js:
var express = require('express');
var app = express();
var path = require('path');
//
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname + '/site/index.html'));
});
app.listen(80);
Answer the question
In order to leave comments, you need to log in
Register where the styles are
https://expressjs.com/ru/starter/static-files.html
app.use(express.static(__dirname + '/dist'))
app.use(express.static(__dirname + '/node_modules'))
The problem is that you are not distributing statics, think about how js / css will be loaded if they are not loaded from the server.
If the index.html page itself loads (text is displayed, etc.), then you probably just specified the wrong path to the css and js files.
Find the channel "Gosha Dudar" on YouTube. Watch
his video , everything is simple and clear there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question