fbpx

JavaScript integration

Find out how to integrate JSQL with vanilla JavaScript

Stack requirements

The JSQL JavaScript library will not work without an account in the JSQL cloud, a backend application (API) integrated with JSQL and integration with the tasks of the runner. To learn more see overview.

Installation

Install via NPM

npm install jsql-javascript

To include library in your project include library in your HTML or include into your tasks runner configuration.

<script src="jsql-javascript.min.js"></script>

Usage

First of all, you need to initiate JSQL object:

var jsql = new JSQL({
 host: 'https://mysite.com/
});

Then you can execute operational functions as on example below:

Example select usage

var jsql = new JSQL({
  host: 'https://mysite.com/'
});

jsql.select('@sql select * from person')
.then(function(result){
// Query result
})
.catch(function(error){
// Database errors
});

For details on using other methods like delete, update, insert and binding parameters, see the documentation.

Close Menu