A node.js client for the BaseX server.
JavaScript
Latest commit a1bc3d9 Mar 23, 2017 @apb2006 committed on GitHub Merge pull request #23 from apb2006/dev
Dev
Permalink
Failed to load latest commit information.
docs socket error events Mar 23, 2017
examples socket error events Mar 23, 2017
lib version 0.8.0 Mar 15, 2017
test update Dec 30, 2014
.gitignore .project Oct 30, 2011
.travis.yml πŸ’Ž Added travis.yml file πŸ’Ž Aug 23, 2012
LICENSE socket error events Mar 23, 2017
README.md socket error events Mar 23, 2017
changelog.md socket error events Mar 23, 2017
debug.js version 0.8.0 Mar 15, 2017
index.js socket error events Mar 23, 2017
package.json socket error events Mar 23, 2017

README.md

basex - A BaseX client for node.js

===========================

This is a BaseX client for Node.js. It is work in progress. It uses the client interface via a socket connection to the BaseX server.

BaseX is a very light-weight, high-performance and scalable XML 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.

Installing the BaseX Node client

NPM NPM

To install with npm:

npm install basex

	$ mkdir myproject
	cd myproject
	$ npm install basex
	basex@0.9.0 ./node_modules/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' }
	end
	close

Installing BaseX

  1. Java is required
  2. Download and install BaseX (tested against version 8.6)
  3. Run basexserver -S

API specification

See commands.md in the docs folder for details of the API.

Tests

There is a test suite using mocha , should and sinon.

mocha -R spec test/ 


  Execute info command
    βœ“ should not error 
    βœ“ should have reply 

  Send an valid xquery statement:  2+2
    βœ“ It should not error 
    βœ“ It should equal 4 

  Send an invalid command:  2+
    βœ“ It should  error 

  Create a database
    βœ“ It should not error 

  Add a document
    βœ“ It should not error 

  drop db database
    βœ“ It should not error 

  drop db database
    βœ“ It should not error 

  Send a xquery and iterate over the result items
    βœ“ It should not error 
    βœ“ It should return an array 

  create query and bind 
    βœ“ It should not error 
    βœ“ It should return a string 

  13 tests complete (408 ms)

Tools

Javascript is formated using js-beautify js-beautify -r index.js

Documentation is generated using jsdoc -r -d docs --verbose index.js

Contributing

Anyone is welcome to submit issues and pull requests

Thanks to:

Todo

  • stream i/o
  • reconnect

Alternative clients

Inspiration

Parts inspired by node_redis, BaseX Java client

License

BSD license

Bitdeli Badge