I want to serve html files from a folder if they exist, otherwise fallback to the dynamic app.
currently I use something like:
var express = require('express');
var app = express()
, server = require('http').createServer(app)
, io = require('socket.io').listen(server);
server.listen(4444);
app.use("/", express.static(__dirname + '/../WebContent/index.html'));
app.use("/styles", express.static(__dirname + '/../WebContent/styles'));
app.use("/script", express.static(__dirname + '/../WebContent/script'));
//here I would like to define a rule like this:
//app.use("*.html", express.static(__dirname + '/../WebContent/*html'));
How can I achieve this?
Some tutorials use a module called connect
. If it's the most elegant solution to my problem, how can I integrate connect to my current code?