简体   繁体   English

Strapi和前端(反应)托管

[英]Strapi & front end (react) hosting

I am looking to make a strapi (headless CMS) and react app and I can find some tutorials about it online, but I can't find much about the best or affordable hosting options. 我希望制作一个trapi(无头CMS)并响应应用程序,我可以在网上找到一些有关它的教程,但是我找不到关于最佳或负担得起的托管选项的很多信息。

Do I need to host the two separately? 我需要分别托管两个吗? Or can I host them together? 还是可以将它们托管在一起? For instance, if I use heroku, can I host them in the same Dyno? 例如,如果我使用heroku,是否可以将它们托管在同一个Dyno中?

To be clear, I would like to host the Strapi back end and the react front end in the same place. 需要明确的是,我想将Strapi后端 react前端放在同一位置。 Is that possible? 那可能吗?

Strapi is a node.js based project, so you can host Strapi anywhere as long as the service supports node.js . Strapi是一个基于node.js的项目,因此您可以在任何地方托管Strapi,只要该服务支持node.js

Strapi supports a lot of database, so you can host your database separately with Strapi like mongolab . Strapi支持很多数据库,因此您可以像mongolab一样与Strapi分别托管数据库。

Strapi is a headless CMS, which means it generates API for your front-end, so you can host your front-end code separately as well. Strapi是无头CMS,这意味着它会为您的前端生成API,因此您也可以单独托管前端代码。

The best solution is to host your back-end application (in this case Strapi) in one server. 最好的解决方案是将后端应用程序(在本例中为Strapi)托管在一台服务器中。

And you have to host the build of your front-end application (in this case React) in a CDN. 而且,您必须在CDN中托管前端应用程序(在本例中为React)的构建。

With this way you can manage precisely resources your allocate to each part of your application. 通过这种方式,您可以精确地管理分配给应用程序每个部分的资源。

After that if you want to host your application in the same server, you can use the public folder that offer Strapi. 之后,如果你想举办在同一个服务器应用程序时,您可以使用public文件夹,提供Strapi。 BUT IT S NOT A GOOD PRACTICE! 但是这不是一个好习惯!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM