77

GitHub - bluzi/jsonstore: Store your data just by sending simple HTTP requests

 6 years ago
source link: https://github.com/bluzi/jsonstore
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

68747470733a2f2f77706f66666963653336352e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031372f30372f72656163742d6c6f676f2e706e67 68747470733a2f2f692e636c6f756475702e636f6d2f7a6659366c4c376546612d3330303078333030302e706e67 68747470733a2f2f63646e2d696d616765732d312e6d656469756d2e636f6d2f6d61782f3936302f312a707866712d696b4c387a504533527947423278626e672e706e67 68747470733a2f2f7777772e766563746f726c6f676f2e7a6f6e652f6c6f676f732f6a735f7765627061636b2f6a735f7765627061636b2d636172642e706e67

logo.png

Start storing your data in the cloud in 2 seconds

jsonstore.io

jsonstore.io offers a free, secured and JSON based cloud datastore for small projects. Just enter https://www.jsonstore.io/, copy the URL and start sending HTTP requests to communicate with your datastore. POST requests will save data, PUT requests modify data, DELETE requests delete data and GET requests retrieves data.

Examples

Make sure to replace the URL in the examples to your own endpoint, that can be found at https://www.jsonstore.io/.

CURL

POST

The following command will create a user in /users/1:

curl -XPOST -H "Content-type: application/json" -d '{
  "name": "john.snow",
  "age": 31
}' 'https://www.jsonstore.io/cf024bb815a93131ce9fed91b1f9dafa43a3c557e9be66e66fd76df5c64f10fe/users/1'

GET

The following command will retrieve the user we created earlier:

curl -XGET -H "Content-type: application/json" 'https://www.jsonstore.io/cf024bb815a93131ce9fed91b1f9dafa43a3c557e9be66e66fd76df5c64f10fe/users/1'

PUT

The following command will change the age of the user to 32:

curl -XPUT -H "Content-type: application/json" -d '32' 'https://www.jsonstore.io/cf024bb815a93131ce9fed91b1f9dafa43a3c557e9be66e66fd76df5c64f10fe/users/1/age'

DELETE

The following command will delete the user:

curl -XGET -H "Content-type: application/json" 'https://www.jsonstore.io/cf024bb815a93131ce9fed91b1f9dafa43a3c557e9be66e66fd76df5c64f10fe/users/1'

JavaScript

POST

fetch('https://www.jsonstore.io/cf024bb815a93131ce9fed91b1f9dafa43a3c557e9be66e66fd76df5c64f10fe/users/1', {
  headers: {
    'Content-type': 'application/json'
  },
  method: 'POST',
  body: { name: 'john snow', age: 31 },
});

GET

const user = await fetch('https://www.jsonstore.io/cf024bb815a93131ce9fed91b1f9dafa43a3c557e9be66e66fd76df5c64f10fe/users/1')
  .then(function(response) {
    return response.json();
  })

PUT

fetch('https://www.jsonstore.io/cf024bb815a93131ce9fed91b1f9dafa43a3c557e9be66e66fd76df5c64f10fe/users/1/age', {
  headers: {
    'Content-type': 'application/json'
  },
  method: 'PUT',
  body: 32,
});

DELETE

fetch('https://www.jsonstore.io/cf024bb815a93131ce9fed91b1f9dafa43a3c557e9be66e66fd76df5c64f10fe/users/1', {
  method: 'DELETE',
});

Contribution

Any type of feedback, pull request or issue is welcome.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK