I dont't find yet how to do this with ruby, so I use a npm
package.
github repository: https://github.com/typicode/json-server
Note: g
option has been used to install the package globally (for all users).
npm install -g json-server
As a front end developper you don't have installed Postgre or Mysql. Don't forget we have less than 4 minutes now.
Therefore we're creating a json file:
{
"kings":[
{
"id": 1,
"name": "Edmund lronside",
"country": "United Kingdom",
"house": "House of Wessex",
"years": "1016"
},
{
"id": 2,
"name": "Cnut",
"country": "United Kingdom",
"house": "House of Denameark",
"years": "1016-1035"
},
{
"id": 3,
"name": "Harold I Harefoot",
"country": "United Kingdom",
"house": "House of Denameark",
"years": "1035-1040"
},
{
"id": 4,
"name": "Harthacanut",
"country": "United Kingdom",
"house": "House of Denameark",
"years": "1040-1042"
},
{
"id": 5,
"name": "Edward the Confessor",
"country": "United Kingdom",
"house": "House of Wessex",
"years": "1042-1066"
}
]
}
json-server --watch db.json
You've done it.