apache mod_rewrite是否等效于node.js? [英] apache mod_rewrite equivalent for node.js?

查看:72
本文介绍了apache mod_rewrite是否等效于node.js?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有与Apache.mod_rewrite一样的Node.js等效模块?还是有一个提供等效功能的标准语言构造?

Is there an equivalent module for Node.js that does what Apache's mod_rewrite does? or is there a standard language construct that provides equivalent functionality?

我刚刚开始使用Node并希望将服务器转换为该平台.

I'm just getting started with Node and looking to convert my server to this platform.

推荐答案

如前面的答案所建议,您需要自己编写;前面的两个答案都更倾向于专门处理不同的路径.

As suggested by the previous answers you need to write it yourself; the two previous answers were both more orientated towards handling different paths specially.

您可能会发现我的节点反向代理很有帮助,因为它有很多帮助处理重写规则的代码集.这与以前的答案不同,因为它允许您匹配"/people/([[az] *)""规则,然后重定向到非常相似的"/cgi-bin/index.cgi?user=$1"进行mod_rewrite.

You might find my node reverse proxy helpful, as it has a lot of code for handling rewrite rules. This is different than the previous answers because it allows you to match on a rule such as "/people/([a-z]*)" and redirect to "/cgi-bin/index.cgi?user=$1" which is very similar to mod_rewrite.

这篇关于apache mod_rewrite是否等效于node.js?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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