简体   繁体   English

如何部署一个简单的 json-server?

[英]How to deploy a simple json-server?

I completed an online React course and deployed my application to Heroku.我完成了一个在线 React 课程并将我的应用程序部署到 Heroku。 During development, I used the 'json-server' module found at https://github.com/typicode/json-server .在开发过程中,我使用了https://github.com/typicode/json-server 上“json-server”模块 This served up a folder on my computer which contained a simple json file and a few images for my website while conforming with the REST API.这在我的计算机上提供了一个文件夹,其中包含一个简单的 json 文件和我网站的一些图像,同时符合 REST API。 What do I need to do to get the server to operate independently of my machine so that my application can fetch the data ?我需要做什么才能让服务器独立于我的机器运行,以便我的应用程序可以获取数据? I have zero experience doing this.我这样做的经验为零。

if you mean you want to create a server for your site,如果您的意思是要为您的站点创建服务器,
first of all, you need to get a server, which can run nodejs , then you need to deploy and run your JSON server via a nodejs (express) app.首先,您需要获得一个可以运行nodejs的服务器,然后您需要通过nodejs (express) 应用程序部署和运行您的JSON server
then you can connect to your server via your website/app in order to do these things, you can follow tutorials there are lots of tutorials about it.然后您可以通过您的网站/应用程序连接到您的服务器以执行这些操作,您可以按照教程进行操作,有很多关于它的教程。 hope you got the idea.希望你明白了。

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

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