# JSON Server Doesn't Work on Netlify

**URL:** <https://answers.netlify.com/t/json-server-doesnt-work-on-netlify/32351>\
**Category:** Support\
**Tags:** deployment, netlify-newbie\
**Created:** [February 11, 2021, 2:53pm UTC](https://answers.netlify.com/t/json-server-doesnt-work-on-netlify/32351 "2021-02-11T14:53:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![clearwater](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@clearwater](https://answers.netlify.com/u/clearwater)\
**Post date:** [February 11, 2021, 2:53pm UTC](https://answers.netlify.com/t/json-server-doesnt-work-on-netlify/32351/1 "2021-02-11T14:53:26Z")

</div>

PLEASE help us help you by writing a good post!

- we need to know your netlify site name. Example: `gifted-antelope-58b104.netlify.app`
- DNS issues? Tell us the custom domain, tell us the error message! We can’t help if we don’t know your domain.
- Build problems? Link or paste the FULL build log & build settings screenshot

The better the post - the faster the answer.

Hello, I am a beginner of netlify.

> **[React App](https://elated-saha-bee70d.netlify.app/)**
>
> Web site created using create-react-app

here is my netlify site.  
There is a problem. When I run this app on local, I should run both react-app(localhost:3000) and **json-server api(localhost:3001)**.  
I had to run manually.

 ![github](https://global.discourse-cdn.com/netlify/original/3X/9/5/95d890ede860fc510fb032a288a9bb6d1e3df826.png)  
Currently, it is normally running just react-app.  
json-server in “api” directory is not working  
on netlify, I want to run this command  
_cd api_  
_npm start_  
“scripts”: {

```
"start": "json-server -p 3001 -w db.json"

```

}

Please help me!

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [February 11, 2021, 4:51pm UTC](https://answers.netlify.com/t/json-server-doesnt-work-on-netlify/32351/2 "2021-02-11T16:51:17Z")

</div>

You can’t run a live server on Netlify which is what you’re trying to do. Try using Netlify Functions to get JSON responses.

---

<div class="post-metadata">

**Author:** ![clearwater](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@clearwater](https://answers.netlify.com/u/clearwater)\
**Post date:** [February 11, 2021, 5:03pm UTC](https://answers.netlify.com/t/json-server-doesnt-work-on-netlify/32351/3 "2021-02-11T17:03:05Z")

</div>

Thank you always…  
Could you please explain more detail?  
with Netlify functions, can I make json-server work?

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [February 11, 2021, 5:04pm UTC](https://answers.netlify.com/t/json-server-doesnt-work-on-netlify/32351/4 "2021-02-11T17:04:53Z")

</div>

No, you can’t get a live server to work in any case. With Netlify Functions you can get responses as JSON. Each function has its own URL. You can call the function, do some processing on the server and return a JSON response. Try here: [https://functions-playground.netlify.app/](https://functions-playground.netlify.app/)

---

<div class="post-metadata">

**Author:** ![mattbtay](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/mattbtay/32/907_2.png) [@mattbtay](https://answers.netlify.com/u/mattbtay)\
**Post date:** [February 24, 2021, 5:41pm UTC](https://answers.netlify.com/t/json-server-doesnt-work-on-netlify/32351/5 "2021-02-24T17:41:36Z")

</div>

I’m looking at doing something similar - my build command is `json-server /path/to/file.json & yarn build` which does work - sort of. When i make a post request the server crashes. Is that what is expected when you say that this can’t work.

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [February 24, 2021, 5:52pm UTC](https://answers.netlify.com/t/json-server-doesnt-work-on-netlify/32351/6 "2021-02-24T17:52:07Z")

</div>

> [@mattbtay](#):
>
> When i make a post request the server crashes

Server crashes? How did you get a server to work in the first place?

Just to clarify, Netlify can’t listen for your requests, etc. You can roughly think of it as a cloud storage but only for small HTML, CSS, JS files. They can only be downloaded by the end user. The closest thing to what is being requested here is Netlify Functions as I mentioned above. Read more here: [[Support Guide] Can I run a web server, HTTP listener, and/or database at Netlify?](https://answers.netlify.com/t/support-guide-can-i-run-a-web-server-http-listener-and-or-database-at-netlify/3078)

---

<div class="post-metadata">

**Author:** ![mattbtay](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/mattbtay/32/907_2.png) [@mattbtay](https://answers.netlify.com/u/mattbtay)\
**Post date:** [February 24, 2021, 6:06pm UTC](https://answers.netlify.com/t/json-server-doesnt-work-on-netlify/32351/7 "2021-02-24T18:06:32Z")

</div>

yea it was “working” like an hour ago, must have been seeing cache version when there was a static json file. weird. thanks.

---

<div class="post-metadata">

**Author:** ![blar](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/blar/32/40554_2.png) [@blar](https://answers.netlify.com/u/blar)\
**Post date:** [August 24, 2022, 6:28am UTC](https://answers.netlify.com/t/json-server-doesnt-work-on-netlify/32351/8 "2022-08-24T06:28:10Z")

</div>

Hi! If I may, for novices like me… Netlify functions cannot take any kind of POST, PUT, PATCH, UPDATE, or DELETE call… Because it’s only a FUNCTION 🤣

It took a couple of days to get this through my thick skull. It can respond to GET… but only with hard-coded data. Once it is built/deployed, it’s just a functional old funky function.

If a function could take in new data (mutate state), it wouldn’t be a function! Because then f(x) wouldn’t always give the same result.

The great thing about Netlify is it gives noooobs like me powers beyond my abilities 😊
