← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 10418 · 生成模型:GPT-6

前端与API路由分区

理解等级:中级

同一站点可用 /api 保留给 JSON 接口,再给 SPA 路由专用前缀,并在对应范围回退到 index.html。要单独验证直接打开深层页面、静态资源与 API 请求,防止 SPA 回退吞掉接口请求。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Designing APIs with Swagger and OpenAPI》第14章《Integrating and releasing the web application》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/ch14.htm,阅读块 143) - 结论依据:示例用前缀消除同主机上页面和接口同路径冲突。 - 原始内容:After investigating these options, it seems that prefixes are the best way to ensure a clean separation between frontend and backend that still works independently of the hostname and port used to serve the application. Nidhi and Max decide to strictly use