Git Product home page Git Product logo

kvs's Introduction

KVS

This is a simple REST-ful in-memory key/value store. I wrote this as a means to learn a little bit about how golang can respond to HTTP requests, and how you can parse and generate JSON data. I don't really expect it to be useful to anyone.

Endpoints

/set

Given a JSON data structure with a "key" and a "value" via a POST, add the k/v pair to the store with the "key" as the key, and the "value" as the value. Keys must be strings, but values can be anything that JSON supports

curl --data '{"key": "foobar", "value": ["one", "two", "three"]}' -XPOST localhost:8000/set

/get

Given a JSON data structure with a "key" via a GET, try to retrieve that key from the k/v store and return the bare value

curl --data '{"key": "foobar"}' -XGET localhost:8000/get

/all

A GET request with no data will return a JSON blob of the entire k/v store

curl -XGET localhost:8000/all

/drop

A POST request with a JSON data structure containing a "key" will try to remove the item in the k/v store that has that key

curl --data '{"key": "baz"}' -XPOST localhost:8000/drop

kvs's People

Contributors

sjahl avatar

Stargazers

Aaron Bieber avatar

Watchers

 avatar

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.