快递js路线处理

时间:2014-11-11 13:30:51

标签: node.js express

在我的应用程序中,我设置了静态文件夹,其中有一个' index.html'文件。

我想在路线 / profile

上渲染该文件

有可能吗?

1 个答案:

答案 0 :(得分:0)

是的,你可以这样做。看看下面的代码。

var app=require('express')();
app.use("/profile", lib.express.static("./public"));

此处./public是包含index.html文件的文件夹的原始位置。