simple online nosql database database with REST API and MongoDB queries
  • Features
  • Docs
  • Blog
  • Templates
  • Pricing
  • Contact
  • Sign Up
  • Log In

Blog

 The latest news and articles about restdb.io  

Database templates!
Don't forget to visit our template catalog! It's the fastest way to get up and running with a restdb.io database. View templates »

New restdb.io JavaScript API makes databases more fun for webdevs

by Jon Erik Solheim
|
API|
  • Share on Facebook
  • Tweet
  • Add to Pocket
  • Share on LinkedIn
  • Send email

restdb.io can now autogenerate a complete JavaScript API* for your database. This makes it easy for developers to create web applications with dynamic content. The API also ensures that your code follows the schema for your database. 

Read on for a simple example on how to use the JavaScript API.
The JavaScript API is a dynamic script resource that you include in your web page. The only dependency is that your page must load JQuery before the API.
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();

Getting and deleting stuff is also easy:

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 :)

Read more about that and other details in the docs here: https://restdb.io/docs/javascript-api
  • Share on Facebook
  • Tweet
  • Add to Pocket
  • Share on LinkedIn
  • Send email

All Posts


Search

Topics

  • API
  • Authentication
  • Case study
  • Features
  • Howto
  • Integrations
  • Newsletter
  • Productivity
  • Prototyping
  • Tutorials
  • User

restdb.io is a fast and simple NoSQL cloud database service. With restdb.io you get schema, relations, REST API and an efficient multi-user admin UI for working with data.

Our customers use it for backends, business databases, API-first CMS, data collection and much more. It is easy to get started with the free development plan.

Start Building »

  • Site Links
  • Home Page
  • About Us
  • Contact
  • Blog
  • Templates Catalog
  • Cloud Service
  • Features
  • Pricing
  • Terms & Conditions
  • Privacy Policy
  • Sign Up »
  • Documentation
  • Overview
  • Getting Started
  • Coding against the API
  • Utils
  • Security and Admin
© 2025 restdb.io