部署使用json服务器作为Godaddy cPanel后端的create-react-app

时间:2020-11-03 12:55:21

标签: reactjs react-redux axios cpanel json-server

我参加了Stephen Grider关于React和Redux的Udemy课程。他带领我们完成了一个构建basic Twitch clone的工作,该工作使用json-server作为后端数据库。我需要部署这样的应用程序,最好使用Godaddy cPanel,因为我已经购买了域名和主机。

json-server之外,我已经成功部署了所有其他产品。仅当项目指向http:// localhost:3001并且我正在运行json-server时,该应用程序才能在我的机器上正常运行。

import axios from "axios";

export default axios.create({
  baseURL: "http://localhost:3001",
});

如何部署json服务器,以便访问我的网站的任何人都可以访问该应用程序?我能找到的最接近答案的是这个question,但我没有使用Heroku。可以将json-server React应用程序部署到Godaddy cPanel,还是我需要使用json-server以外的其他方式存储数据库?

0 个答案:

没有答案