An open API service indexing awesome lists of open source software.

https://github.com/minikin/json-server

Fake Json Server hosted on Heroku
https://github.com/minikin/json-server

heroku json server

Last synced: about 2 months ago
JSON representation

Fake Json Server hosted on Heroku

Awesome Lists containing this project

README

          

# Json Server

### Deploy to Heroku

1 . [Create your database](#create-your-database)

2 . Create an account on
[https://heroku.com](https://heroku.com)

3 . Install the Heroku CLI on your computer:
[https://devcenter.heroku.com/articles/heroku-cli](https://devcenter.heroku.com/articles/heroku-cli)

4 . Connect the Heroku CLI to your account by writing the following command in your terminal and follow the instructions on the command line:
```bash
heroku login
```

5 . Then create a remote heroku project, kinda like creating a git repository on GitHub. This will create a project on Heroku with a random name. If you want to name your app you have to supply your own name like `heroku create project-name`:
```bash
heroku create my-cool-project
```

6 . Push your app to __Heroku__ (you will see a wall of code)
```bash
git push heroku master
```

7 . Visit your newly create app by opening it via heroku:
```bash
heroku open
```

8 . For debugging if something went wrong:
```bash
heroku logs --tail
```

---

#### How it works

Heroku will look for a startup-script, this is by default `npm start` so make sure you have that in your `package.json` (assuming your script is called `server.js`):
```json
"scripts": {
"start" : "node server.js"
}
```

You also have to make changes to the port, you can't hardcode a dev-port. But you can reference herokus port. So the code will have the following:
```js
const port = process.env.PORT || 4000;
```