Установил nodejs, expressjs. Не получается подключить локальный bootstrap к html файлу. Не работает именно при localhost:3000. Если запустить отдельный index.html, то все локальные пути работают.
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.css" type="text/css">
<title>Hello, world!</title>
</head>
<body>
<div class="container">
<h1>Hello, world!</h1>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="node_modules/jquery/dist/jquery.slim.min.js" type="text/javascript"></script>></script>
<script src="node_modules/popper.js/dist/popper.min.js" type="text/javascript"></script>></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js" type="text/javascript"></script>></script>
</body>
</html>
package.json:
{
"name": "bootstrap-protipe",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"bootstrap": "^4.2.1",
"express": "^4.16.4",
"font-awesome": "^4.7.0",
"fs": "0.0.1-security",
"jquery": "^3.0.0",
"popper.js": "^1.14.6"
}
}
Сервер запускается app.js
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.sendFile( __dirname + '/index.html');
})
app.listen(3000, function () {
console.log('Example app listening on port 3000!');
});
css
получается подключить? П.С. - никогда ничего не ложите в папкуnode_modules