v4 代码迁移:后端概览
¥v4 code migration: Backend overview
此后端代码迁移概述是 v4 代码迁移指南.1 的一部分。
¥This backend code migration overview is part of the v4 code migration guide.
Strapi 的大部分后端已在 Strapi v4 中完全重写:
¥Most of the backend of Strapi has been entirely rewritten in Strapi v4:
Strapi v4 服务器的核心功能(路由、策略、控制器和服务)使用工厂功能。可以使用 交互式
strapi generate
CLI 创建新文件。¥The core features of a Strapi v4 server (routes, policies, controllers, and services) use factory functions. The new files can be created with the interactive
strapi generate
CLI.Strapi v4 中 policies 和 middlewares 之间有明显的区别,这导致了 路由中间件 的引入。
¥There is a clear distinction in Strapi v4 between policies and middlewares, which leads to the introduction of route middlewares.
Strapi v3 和 Strapi v4 中的 项目结构 有所不同。该项目结构可以使用 Strapi 代码模块 进行迁移,本指南不做详细介绍。
¥The project structure is different in Strapi v3 and Strapi v4. The project structure can be migrated with Strapi codemods and is not covered in details in this guide.
将 Strapi 应用的后端迁移到 v4 需要更新所有这些核心功能:
¥Migrating the backend of a Strapi application to v4 requires updating all of these core features:
或者,根据你在 Strapi v3 中对这些功能的使用情况,你可能还需要迁移:
¥Optionally, depending on your usage of these features in Strapi v3, you might also need to migrate:
本后端代码迁移指南中列出的专用简短指南并不是 v4 后端自定义功能的详尽资源,这些功能在 后端定制 文档中进行了描述。
¥The dedicated short guides listed in this backend code migration guide are not exhaustive resources for the v4 backend customization features, which are described in the backend customization documentation.
Strapi 后端迁移到 v4 后,你可以继续迁移 frontend。
¥Once the backend of Strapi has been migrated to v4, you can proceed to migrating the frontend.