假设有像
这样的网址http://xyz.abc/a/b/c/d/e/f/g/h/i/j/k
http://xyz.abc/a/b/c/d/e/f/
如何通过快递
获取任意数量的参数尝试将其与
一起使用router.use("/:param1/:param2/:param3",express.static('./public/index.html'));
router.use("/:param1/:param2/:param3/:param4/:param5",express.static('./public/index.html'));
可能的正则表达式已尝试但失败
router.use('\/:(\w+)', express.static('./public/index.html'))
答案 0 :(得分:1)
尝试使用中间件,以便每个请求都指向该中间件。在该中间件中发送文件。
例如: -
var express = require('express);
var path = require('path');
var app = express();
app.use(function(req, res, next) {
res.sendfile(path.join(__dirname, '/views/abc.html'));
});