Established nodejs, expressjs. I can not connect a local bootstrap to the html file. It does not work for localhost: 3000. If you run a separate index.html, then all local paths work.
<!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" } } Server starts 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!'); });
cssturns to connect? P.S. - nevernode_modulesanything in thenode_modulesfolder - Dmytryk