在我的代码中,我目前有
app.use(express.static(__dirname + "/../styles"))
app.use(express.static(__dirname + "/../public"))
app.use(express.static(__dirname + "/../scripts"))
app.use("/flosses", express.static(__dirname + "/../styles"))
app.use("/flosses", express.static(__dirname + "/../public"))
app.use("/flosses", express.static(__dirname + "/../scripts"))
app.use("/flosses/edit", express.static(__dirname + "/../styles"))
app.use("/flosses/edit", express.static(__dirname + "/../public"))
app.use("/flosses/edit", express.static(__dirname + "/../scripts"))
app.use("/accounts", express.static(__dirname + "/../styles"))
app.use("/accounts", express.static(__dirname + "/../public"))
app.use("/accounts", express.static(__dirname + "/../scripts"))
这是非常乏味的。我可以做这样的事情吗?
app.use("*",express.static(__dirname + "/../scripts"))
注意:我的 css、js 和图像在 3 个不同的目录中,我需要 /thing1/index.css、/thing2/index.css 等。
谢谢,
阿里