The following example uses the "rdb-simpledb" database to create an API for that database. Include this script in the head of your html page (replacing the database name with your own):
<script src="https://rdb-simpledb.restdb.io/rest/_jsapi.js">
When the auto generated JavaScript is loaded, you can connect to your database. This is done by creating a new instance of the restdb.io api and assign it to a variable:
var db = new restdb("<your-api-key> or <JWT token>");
Query some data records from the "products" collection:
var query = {}; // all var hint = {"$max": 10}; // first 10 only db.product.find(query, hint, function(err, productlist){ // productlist is an array of product objects ... }
Creating a new object and saving it to the database is just as simple:
var p = new db.product({name: "from jsapi"}); p.save();
db.product.getById("5662d2d7632700720000008c", function(err, res){ var nukem = new db.product(res); nukem.delete(); });
Thats it, you're ready to start developing your own application,
have fun coding :)
Note that you can generate a JavaScript documentation page for your API, handy if the boss asks :)