知识卡片
按需代码是可选约束
按需代码允许服务端向客户端发送可执行代码,以扩展客户端功能,例如交付运行界面所需的 JavaScript。它是 REST 的可选约束,只适用于后端确实提供客户端界面的场景;不能把“所有 REST API 必须下发代码”当成设计要求。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《Microservice APIs》第 4 章《Principles of REST API design》(源文件:_epub-src/OEBPS/Text/04.htm)
- 结论依据:原文直接说明服务端可传可执行代码,并明确这项约束可选且只适用于后端提供客户端界面的应用。
- 原始内容:Servers can extend the functionality of a client application by sending executable code directly from the backend, such as JavaScript files needed to run a UI. This constraint is optional and only applies to applications in which the backend serves the client interface.