具有多个端点的应用 - 路由[UI5+ node.js]
我确实有一个具有多个端点的应用程序,问题是,这个新端点未通过URL识别。
例如:
在server.js
内有get
函数:
app.get('/TwoWonders', function (req, res) {
var items = [
{name: 'Example1', location: 'Rome'},
{name: 'Example2', location: 'Greece'}
]
res.send(items);
});
通过文件中的端口,即localhost:3000 /twoWonders
我可以访问twoWonders
的内容。
问题 将twOwonders
放在单独的文件中时,但是它不起作用/无法识别。我如何使它起作用?
更新:找不到这个问题的灵魂
I do have an application with multiple endpoints, the issue is, this new endpoints aren't recognized via an url.
For example:
Within server.js
there is the GET
-function:
app.get('/TwoWonders', function (req, res) {
var items = [
{name: 'Example1', location: 'Rome'},
{name: 'Example2', location: 'Greece'}
]
res.send(items);
});
Via the port set in the file, i.e. localhost:3000/TwoWonders
i could access the contents of TwoWonders
.
Issue
When puting TwoWonders
to a separate file, wonders.js
, the url
appropriate to it would be localhost:3000/wonders/TwoWonders
, however it doesn't work/isn't recognized. How do i make it work ?
Update: couldnt find the soultion to this issue
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论