根的node.js express.js路由重定向到// [英] node.js express.js routing of root Redirecting to //

查看:142
本文介绍了根的node.js express.js路由重定向到//的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的node.js express.js应用程序中路由根路由(http://server:5000/):

I want to route root route (http://server:5000/) in my node.js express.js application:

当我转到 http://server:5000/时,我得到: 重定向到//

When I go to http://server:5000/ I get: Redirecting to //

如果有路线,我会收到相同的消息:

I get the same message if I have a route:

app.get('/',routes.index);

app.get('/', routes.index);

可能是什么问题?

推荐答案

这是Windows中使用Connect的错误:

This was a bug in Windows with Connect: https://github.com/senchalabs/connect/issues/427

您应该在Connect静态中间件中将重定向选项更新或设置为false.

You should update or set the redirect option to false in the Connect static middleware.

这篇关于根的node.js express.js路由重定向到//的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆