- Notifications
You must be signed in to change notification settings - Fork5
Interact with CovenantSQL via proxy in web and node
License
NotificationsYou must be signed in to change notification settings
CovenantSQL/cql-js-driver
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This repo is javascript lib to interact withCovenantSQL local proxy.
Installcql-js-driver
via npm or yarn:
npm install --save cql-js-driver
or
yarn add cql-js-driver
Follow CovenantSQLQuickStart to get you prepared.
We provides testnet proxy for your testing:http(s)://testnet-proxy.covenantsql.io
constconfig={endpoint:'http://testnet-proxy.covenantsql.io',dbid:`${DB_ID}`,// your DB id created by `cql` tools in QuickStart}
- set up CovenantSQL local proxy
$ go get github.com/CovenantSQL/CovenantSQL$ make bin/cql$ rsync -avP ./conf/testnet/{config.yaml,private.key}~/.cql/$ ./bin/cql -adapter 127.0.0.1:11105
- fill in the configs
constconfig={endpoint:'127.0.0.1:11105',// local testnet endpoint without httpsdbid:`${DB_ID}`,// your DB id created by `cql` tools}
importcqlfrom'cql-js-driver'constconfig={...}// see abovecql.createConnection(config).then(async(connection:any)=>{// readconstdata1=awaitconnection.query("select ? + ?",[2.1,3.2]);console.log(data1);// writeconstcreateTableSQL=` CREATE TABLE IF NOT EXISTS contacts (\ contact_id INTEGER PRIMARY KEY, first_name TEXT NOT NULL, last_name TEXT NOT NULL, email text NOT NULL UNIQUE, phone text NOT NULL UNIQUE ); `conststatus1=awaitconnection.exec(createTableSQL)console.log(`exec1 status:`,status1);constdata2=awaitconnection.query("show tables;");console.log(data2);}).catch((e:any)=>console.log(e))
yarn dev
- open
http://localhost:8080/examples/
About
Interact with CovenantSQL via proxy in web and node
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.