有没有办法可以例行忽略某些URL路径?

发布于 2025-02-09 14:37:58 字数 655 浏览 3 评论 0原文

我们正在使用GO(Buffalo)为使用Svelte和Rootify的单页应用程序(SPA)提供API和静态资产。

但是,我想通过Roadify忽略某些路由(例如“/auth/登录”),而是转到GO/Buffalo服务器来处理这些请求。

是否有例行设置?

我看到 ignore 构建config ,但这似乎是要告诉常客在构建路由列表时忽略某些文件,而不是忽略某些URL路径。

(如果需要的话,我也许可以获取我们的/auth/login作为XHR调用工作,然后根据响应实际手动重定向浏览器,但是它会更好/更简单只需直接允许浏览器直接转到/auth/login。)


更新:显然是直接转到/auth/login/code(例如新标签)做我想要的。它只是单击SPA中的一个链接,该链接被Readify拦截。因此,我的问题仍然存在,尽管有些变化:

有没有办法告诉常客不要拦截某些URL路径的链接,而是简单地让浏览器转到该URL(离开水疗中心)?

We're using Go (Buffalo) to serve up both an API and the static assets for a Single-Page Application (SPA) that uses Svelte and Routify.

However, I'd like to have certain routes (e.g. "/auth/login") be ignored by Routify and instead go to the Go / Buffalo server, for handling those requests.

Is there a Routify setting for that?

I see the ignore build config, but that seems to be for telling Routify to ignore certain files when building the list of routes, not ignoring certain URL paths.

(If I have to, I might be able to get our /auth/login call to work as an XHR call, then actually manually redirect the browser based on the response, but it would be nicer/simpler to simply allow the browser to go to /auth/login directly.)


UPDATE: Apparently going to /auth/login directly (e.g. in a new tab) does what I want. It's just clicking a link in the SPA that gets intercepted by Routify. So my question still stands, though slightly altered:

Is there a way to tell Routify not to intercept links to certain URL paths, but to simply let the browser go to that URL (leaving the SPA)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

愛放△進行李 2025-02-16 14:37:58

链接标签上的target属性可以执行我的追求。寻找适当的文档!

如果要使用Anchor的默认导航行为,则可以通过添加target属性。

例行程序将用target属性忽略所有锚。

来源:
https://www.routify.dev/guide/guide/navigation

在我的情况下,我需要,我需要为此:

<a href="/auth/login" target="_self">Login</a>

The target attribute on a link tag does what I was after. Hooray for finding the appropriate documentation!

If you want to use anchor's default navigation behaviour you can do so by adding the target attribute.

Routify will ignore all anchors with target attribute.

Source:
https://www.routify.dev/guide/navigation

So in my case, I needed to do this:

<a href="/auth/login" target="_self">Login</a>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文