Reputation: 2422
I'm just learning how to use Express, and am trying to serve the static files, like the bootstrap.min.css file.
Here's my folder structure:
server.js
/server
/includes
layout.jade
/public
/css
/vendor
/bootstrap
/dist
/css
bootstrap.min.css
/views
index.jade
I'm using wiredep
in my Gulpfile.js, and have tried several different variations of the configuration, and haven't gotten anything. Here's my server.js file:
var express = require('express');
var app = express();
var env = process.env.NODE_ENV = process.env.NODE_ENV || 'development';
var port = process.env.PORT || 5000;
app.use('/server', express.static('public'));
app.set('views', './server/views');
app.set('view engine', 'jade');
require('./server/routes/routes')(app);
app.listen(port, function(err) {
console.log('running server on port: ' + port);
});
I've tried a couple different ways setting the express.static
part, but again, it isn't serving the static files.
Any help would be greatly appreciated.
Upvotes: 1
Views: 367
Reputation: 1593
Try:
app.use(express.static(__dirname + '/server/public'));
on link tag
href = "vendor/bootstrap/dist/css/bootstrap.min.css"
Upvotes: 2