0

如何在 node.js 中编写多个方法(路径)。例如,我将在 localhost:8080 运行节点服务器。

然后我的 url 看起来像 localhost:8080/getinfo、localhost:8080/contactus 等。

4

1 回答 1

1

您需要开始使用路线。尝试这样的事情。

app.get('/methodName', function(req, res) {
  res.render('ViewFile.ejs');
});

将此添加到您的server.js文件中。另外,我会超级建议快递

于 2013-11-15T06:45:17.260 回答