Mobirise Mobirise v4.3.5

2.3 Setting up a Server using json-server

In this tutorial, you will establish a simple server using the json-server node module. At the end of this tutorial, you will be able to:

  • Set up a simple server that makes data available for clients
  • Access the data from the server using a browser
  • Use the json-server as a simple static web server

Resources

2.3.1 How to

1. Download and unzip 'json-server-heroku' from: https://github.com/jesperorb/json-server-heroku

2. Copy 'public/images' folder and 'db.json' file to 'json-server-heroku' folder

3. Create new app <appname> on heroku.com

4. Deploy 'json-server-heroku' to <appname>

$ cd json-server-heroku
$ heroku login -i
$ git init
$ heroku git:remote -a <appname>
$ git add .
$ git commit -am "make it better"
$ git push heroku master
view raw heroku.sh hosted with ❤ by GitHub

2.3.2 Testing

  • http://<appname>.herokuapp.com/dishes
  • http://<appname>.herokuapp.com/leaders
  • http://<appname>.herokuapp.com/comments
  • http://<appname>.herokuapp.com/promotions
  • http://<appname>.herokuapp.com/images/logo.png