NPM安装strapi到现有的NextJS项目

发布于 2025-02-08 17:29:03 字数 356 浏览 0 评论 0原文

我是React,NextJS和NPM的新手,我最近使用此命令创建了一个Next应用程序: NPX Create-Next-App@最新 现在,我想在同一项目中添加strapi。我使用此命令安装strapi: npx create-strapi-app@最新my-project -quickstart 使用此命令,它将为Strapi创建一个新项目。 我看到nextstrapi项目共享许多文件,例如node_modules文件夹中的文件。有没有办法在同一项目中将这些方法进行?还是会弄乱?

I'm new to React, NextJS, and Npm, I recently created a Next app using this command:
npx create-next-app@latest
And now I want to add Strapi to the same project. I used this command to install Strapi:
npx create-strapi-app@latest my-project --quickstart
Using this command, it will create a new project, for Strapi.
I see that the Next and the Strapi projects share a lot of files, such as the files in the node_modules folder. Is there a way to have those in the same project? or would that make a mess?

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

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

发布评论

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

评论(1

旧梦荧光笔 2025-02-15 17:29:03

我得出的结论是,在两个不同的目录上拥有这两个应用程序,每个应用程序都有自己的配置文件和其他模块是正确的方法。我们最终将获得两个应用程序中存在的许多文件和文件夹,但是最好将这两个应用程序完全隔离,因为:

  • 它们在大多数文件夹中具有不同的配置文件。
  • 它们是两个不同的应用其余的网站。
  • 如果将这两个应用程序组合在一起,我们最终将获得目录结构很难使用的目录。

在一个较大的项目中,我们可能会拥有更多API应用程序独立运行的应用程序,最好将这些目录和端口放在不同的目录和端口上。并且在所有应用程序中都有一些重复的文件,不会影响性能,并且不会花费太多存储。

I came to the conclusion that having those two apps on two different directories, with each having their own config files, and other modules, is the right way. We will end up with a lot of files and folders that exist in both apps, but it is simply best that we isolate these two apps from each other completely, because:

  • They have different config files, in most of the folders.
  • they are two different apps, Stapi being the backend api and the admin dashboard, and the Nextjs app being the rest of the website.
  • If those two apps were combined, we would end up with a directory-structure that would be very hard to work with.

In a larger project we might have more api or apps that run independently, and it's best to have those on different directories and ports. And having some duplicate files across all the apps, wouldn't affect performance, and wouldn't take much storage.

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