- Notifications
You must be signed in to change notification settings - Fork4
A node.js client for the BaseX server.
License
Quodatum/basex-node
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
===========================
This is aBaseX client for Node.js.It uses theclient interfacevia a socket connection to the BaseX server.
BaseX is a very light-weight, high-performance and scalableXML Database engine and XPath/XQuery 3.0 Processor,including full support for the W3C Update and Full Text extensions.Built as a lightweight Java server, BaseX also supports XSLT, Webdav and RestXQ.
To install with npm:
npm install @quodatum/basex
$ mkdir myprojectcd myproject$ npm install @quodatum/basex@quodatum/basex@1.0.0 ./node_modules/@quodatum/basex
Once BaseX is installed and the BaseX server is running, test it.
$cd examples/$ node Example.js milliseconds: 0{ result:'1 2 3 4 5 6 7 8 9 10', info:'\nQuery executed in 0.38 ms.\n' }endclose
- Java is required
- Download and install BaseX(tested against versions 9.6,8.6)
- Run
basexserver -S
Seecommands.mdin the docs folder for details of the API.
There is a test suite usingmocha,should andsinon.
mochatest [auth] password good √ should not error [auth] password bad √ should throw error [commands] Execute infocommand √ should not error √ should have reply [commands] Send valid xquery statement: 2+2 √ It should not error √ It should equal 4 [commands] Send an invalid command: 2+ √ It should error [commands] Create a database testdb using execute √ It should not error [commands] Add a document √ It should not error [commands] Add an invalid document √ It should error [commands] drop db testdb √ It should not error [commands] create database √ It should not error [commands] drop db database √ It should not error [parser] Parser test? √ should pop abc [query] create query andbind √ It should not error √ It shouldreturn a string [query] create query andbind withtype √ It should not error √ It shouldreturn a string [query] Send a xquery and iterate over the result items √ It should not error √ It shouldreturn an array [stream] Create a database testdb from stream √ It should not error [stream] Add doc from stream √ It should not error [stream] drop db testdb √ It should not error [stress] Send a xquery and iterate over the 1000000 result items √ should not error [stress]return megabyte result from execute √ should not error [stress]return megabyte result from query √ should not error 26 passing (2s)
Javascript is formated using js-beautifyjs-beautify -r index.js
Documentation is generated usingjsdoc -r -d docs --verbose index.js
Anyone is welcome to submit issues and pull requests
Thanks to:
- stream i/o
- reconnect
- https://github.com/alxarch/basex-stream
- https://github.com/nerdenough/node-basex
- https://github.com/hanshuebner/simple-basex
Parts inspired bynode_redis,BaseX Java client
BSD license
About
A node.js client for the BaseX server.