Giter Club home page Giter Club logo

gunstore.io's Introduction

Start storing your data in the cloud in 2 seconds

Deploy

About

gunstore is a clone of jsonstore and provides a datastore for small projects based on Gun DB. Just launch and access your instance, 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 actual endpoint URL!

npm install
npm start

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
}' 'http://localhost:3000/cf024bb815a93131ce9fed91b1f9dafa43a3c557e9be66e66fd76df5c64f10fe/users/1'

GET

The following command will retrieve the user we created earlier:

curl -XGET 'http://localhost:3000/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' 'http://localhost:3000/cf024bb815a93131ce9fed91b1f9dafa43a3c557e9be66e66fd76df5c64f10fe/users/1/age'

DELETE

The following command will delete the user:

curl -XDELETE 'http://localhost:3000/cf024bb815a93131ce9fed91b1f9dafa43a3c557e9be66e66fd76df5c64f10fe/users/1'

JavaScript

POST

fetch('http://localhost:3000/cf024bb815a93131ce9fed91b1f9dafa43a3c557e9be66e66fd76df5c64f10fe/users/1', {
  headers: {
    'Content-type': 'application/json'
  },
  method: 'POST',
  body: { name: 'john snow', age: 31 },
});

GET

const user = await fetch('http://localhost:3000/cf024bb815a93131ce9fed91b1f9dafa43a3c557e9be66e66fd76df5c64f10fe/users/1')
  .then(function(response) {
    return response.json();
  })

PUT

fetch('http://localhost:3000/cf024bb815a93131ce9fed91b1f9dafa43a3c557e9be66e66fd76df5c64f10fe/users/1/age', {
  headers: {
    'Content-type': 'application/json'
  },
  method: 'PUT',
  body: 32,
});

DELETE

fetch('http://localhost:3000/cf024bb815a93131ce9fed91b1f9dafa43a3c557e9be66e66fd76df5c64f10fe/users/1', {
  method: 'DELETE',
});

Contribution

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

Acknowledgements

gunstore is a clone of jsonstore by bluzi

gunstore.io's People

Contributors

dependabot[bot] avatar i001962 avatar lmangani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gunstore.io's Issues

Client build fails

Hi. npm run client:build fails with the following error:

> [email protected] client:build /home/max/play/gunstore.io
> webpack

Hash: 8f3d7d29289b2e922bac
Version: webpack 3.11.0
Time: 211ms
       Asset       Size  Chunks             Chunk Names
   bundle.js    3.27 kB       0  [emitted]  main
 favicon.png    5.98 kB          [emitted]  
css/main.css    2.44 kB          [emitted]  
  index.html  929 bytes          [emitted]  
   [0] multi ./client/src/index.js 28 bytes {0} [built]
   [1] ./client/src/index.js 680 bytes {0} [built] [failed] [1 error]

ERROR in ./client/src/index.js
Module build failed: SyntaxError: Unexpected token (5:16)

  3 | import App from './components/app';
  4 | 
> 5 | ReactDOM.render(<App />, document.getElementById("app"));
    |                 ^

 @ multi ./client/src/index.js
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] client:build: `webpack`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] client:build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Is it possible that the .babelrc is missing?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.