firebase - 如何在firebase托管的一台服务器上部署nodejs服务器(发送电子邮件)和vuejs应用程序
问题描述
这可能听起来很奇怪,我知道...人们会认为我应该使用 Firebase 云功能来发送邮件,是的,我确实这样做了,但意外的是,它只是停止了发送,我找不到解决方案。
我在 Nodejs 中创建了一个服务器,并连接了我的前端以向服务器发送一个 POST 请求。现在我想将该服务器部署到 Firebase 托管,因此该服务器将与应用程序一起托管。
sendMessage() {
if (this.$refs.formEmail.validate()) {
this.loading = true;
this.disabled = true;
const data = {
name: this.formData.name,
email: this.formData.email,
message: this.formData.message
};
axios
.post("http://localhost:4000/sendEmail", data)
// eslint-disable-next-line no-unused-vars
.then(res => {
this.disabled = false;
this.loading = false;
this.snackbar = true;
this.successMessage = "Mail sent! We'll respond ASAP.";
this.$refs.formEmail.reset();
})
.catch(err => {
this.disabled = false;
this.loading = false;
this.snackbarError = true;
this.errorMessage = err.message;
});
}
}
那么,有没有我可以将该本地主机部署到firebase的方法,因此可以在不打开节点上的服务器的情况下发送发布请求
解决方案
推荐阅读
- android - 使用体系结构组件导航将数据从单个活动传递到开始目标片段
- xml - 使用 xmlwriter 编写 xmlns 条目的问题
- dialogflow-es - 在 Dialogflow 上开始对话,小写 /start 不起作用
- angular - 角度构建失败,“数据路径'.sourceMap'应该是对象。”
- cmd - 使用 Robocopy 复制用户子文件夹
- sum - 如何根据 id 过滤条件对多行求和?
- java - Play Framework 2.7.0 Config 用于没有来自 application.conf 的常规配置的测试
- c# - dotnet core api returns empty array of braces
- r - Problem with alpha transparency in ggplot2 in R
- angular - 如何在网格中使用嵌套接口值