NancyFX Catch全部路线 [英] NancyFX Catch All route

查看:86
本文介绍了NancyFX Catch全部路线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

NancyFX是否支持ASP.NET MVC(如全部捕获"路由)?我需要一个,它基本上匹配每个URL.这对于构建单页应用程序非常方便.

Does NancyFX supports ASP.NET MVC like 'Catch All' route? I need one, that basically match every URL. This is very handy for building up Single Page applications.

有可能吗?

推荐答案

是的,使用正则表达式

Get[@"/(.*)"] = parameters => {
    return View["viewname", parameters];
};

但是使用NancyFX构建单页应用程序并不需要它-您可以将Get和Post与所有路由逻辑一起使用,而仍然只有一个单页应用程序.

But you don't really need it for building a Single Page Application with NancyFX - you can just use Get and Post with all your routing logic and still have a single page app.

这篇关于NancyFX Catch全部路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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