Skip to content

Commit

Permalink
update dynamicFiles example to handle css
Browse files Browse the repository at this point in the history
  • Loading branch information
BertHartm committed Oct 11, 2014
1 parent 4ba592d commit 646a71d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ex7a-dynamicFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,23 @@ var app = express();
app.use('/static', express.static(__dirname + '/public'));

// map jade files
app.engine('jade', require('jade').__express);
app.engine('jode', require('jade').__express);

// Add a "route" that leads to the req/res, as seen in Node.js
app.get("/", function(req, res){
// Grab a file and respond with that
res.render('index.jade',
res.render('index.jode',
{pageTitle: 'Hello, MakerBar!'}
);
});

app.route(/\/css\/.+/).all(
function(req, res) {
console.log("fetching " + req.url + ".jode");
res.render(req.url.slice(1) + ".jode");
}
);

// Starts up the server
var server = app.listen(1337, function() {

Expand Down
1 change: 1 addition & 0 deletions views/css/asdf.css.jode
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello World!
File renamed without changes.

0 comments on commit 646a71d

Please sign in to comment.