简体   繁体   English

将 web 托管空间与 Node.js 应用程序一起使用的最佳实践?

[英]Best practices to use web hosting space with Node.js app?

I am creating a Node.js app that runs on Heroku.我正在创建一个在 Heroku 上运行的 Node.js 应用程序。 The app will allow the user to upload and store some files.该应用程序将允许用户上传和存储一些文件。

My problem is that, since the app is running on Heroku, the file will be uploaded and stored where the app lays and that is by no means a good solution (the files will be removed at the next deploy and Heroku is not meant to store files).我的问题是,由于应用程序在 Heroku 上运行,文件将被上传并存储在应用程序所在的位置,这绝不是一个好的解决方案(文件将在下一次部署时删除,Heroku 不打算存储文件)。

What are the best practice to upload and store the file into the hosting space given by my domain provider?将文件上传并存储到我的域提供商提供的托管空间中的最佳做法是什么?

When using Heroku, (and any other platform, really), the best practice is to use a file storage If you're saving files, and a database if you're saving regular data.使用 Heroku 时(以及任何其他平台,真的),如果要保存文件,最佳做法是使用文件存储,如果要保存常规数据,则使用数据库。

There are plenty to choose from.有很多可供选择。 The most common ones are:最常见的是:

The absolute easiest way to deal with both file storage and database, is to use Google Firebase.处理文件存储和数据库的最简单方法是使用 Google Firebase。 Firebase is a Google product, which includes everything you need to build an app, except the front end. Firebase 是一款 Google 产品,其中包含构建应用所需的一切,前端除外。 Since you're working on a Node app you are able to use parts of firebase to suit your needs.由于您正在开发 Node 应用程序,因此您可以使用 firebase 的部分组件来满足您的需求。 You can read more at www.firebase.com您可以在www.firebase.com了解更多信息

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

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