GithubHelp home page GithubHelp logo

rethinkdb-api's Introduction

RethinkDB REST API

Exposes RethinkDB as a firebase-like REST API

Dependencies

  • Python
  • Flask
  • RethinkDB

Set up

  1. Download the main.py file and put it on your machine.
  2. Put your RethinkDB connection information on the script.
  3. Set up the routes table with your corresponding tables and indexes.
  4. Generate a complex key.
  5. Run the main.py file with Flask.

Http Methods

Method Description
GET /%s gets the JSON of all documents in the table
GET /%s/%s gets the JSON of the last item in the path, or null if the value doesn't exist
POST /%s/%s either updates the table with the JSON body, or creates a new entry
DELETE /%s/%s deletes the item(s) from the table

Examples

  • Get all documents in the people table:

    • GET /people?key=KEY
  • Get Joe's information from the people table:

    • GET /people/joe/?key=KEY
  • Joe doesn't exist in the table, so let's put him in:

    • POST /people/joe/?key=KEY

    • JSON body:

      • {
        	"name": "Joe",
        	"last_name": "Smith"
        }
  • Maria's last name is incorrect. Let's update it:

    • POST /people/maria/?key=KEY

    • JSON body:

      • {
        	"last_name": "Jones"
        }
  • We don't need John anymore; let's delete his entry:

    • DELETE /people/john/?key=KEY

Structures

Each request is structured as: /TABLE/PATH/OF/THE/ITEM/?key=KEY, which is identical to the Firebase REST API.

Let's assume we have a folder structured like this:

  • Directory
    • Membership
      • Active_Users
      • Inactive_Users

To get all Active Users, we would do: GET /directory/membership/active_users/?key=KEY

rethinkdb-api's People

Watchers

James Cloos 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.