【发布时间】:2012-12-16 23:45:20
【问题描述】:
如果存在,我想从文件夹中提供 html 文件,否则回退到动态应用程序。
目前我使用类似的东西:
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'));
我怎样才能做到这一点?
有些教程使用了一个名为connect 的模块。如果这是解决我的问题的最优雅的解决方案,我如何将连接集成到我当前的代码中?
【问题讨论】: