Code Monkey home page Code Monkey logo

reqlite's Introduction

Reqlite - RethinkDB in JavaScript

Build Status

What is it?

Reqlite is an implementation of a ReQL server in JavaScript. Meaning that you can connect to reqlite with the RethinkDB driver and send queries (create a table, insert documents, filter them, open a chanfeed etc.

./bin/reqlite

Does it work?

Most of the methods work. There are currently 2000+ tests passing.

Why?

The main reasons why this project was started were:

  • Provide an easy way for node developers to test their code without having to start a RethinkDB server.
  • Maybe Meteor will use it to build a mini-rethinkdb - See meteor-rethinkdb
  • Use it on Windows instead of running a Docker container in Vagrant
  • Because it's kind of fun :-)

Version of RethinkDB supported

It currently tries to match RethinkDB 2.2.x.

Run tests

Most of the tests run queries against RethinkDB and reqlite at the same time, and compare the output. Start RethinkDB on port 28015

rethinkdb

And reqlite on port 28016:

node ./lib/node.js --port-offset 1

If you are developing on reqlite, you may want to use

nodemon lib/node.js -- -L --port-offset 1 --debug

Then run:

npm test

Use in the browser

Build

Run in the reqlite repository:

npm run browserify

You then need a driver to connect to reqlite. Clone rethinkdbdash and run:

npm run browserify

Note: The official JavaScript driver currently doesn't work with reqlite because it cannot use a fake tcp connection (yet).

Example

Import rethinkdbdash.js and reqlite.js in your page. Then you can write:

var Reqlite = require('reqlite');
// You cannot use a pool with reqlite
var r = require('rethinkdbdash')({pool: false});

var server = new Reqlite();
// This simulate a fake tcp connection
var fakeTcpConnection = server.createConnection();

// Create a rethinkdbdash connection by providing the fake tcp connection
r.connect({
  connection: fakeTcpConnection
}).bind({}).then(function(connection) {
  return r.expr('Ok').run(connection);
}).then(function(result) {
  // result === 'Ok'
}).error(function(error) {
  // Handle error
});

Roadmap

There are tons of things left to do! See the issues tracker

Who did that?

Mostly Michel Tu, but hopefully people will love this project and send tons of pull requests!

Contribute

See CONTRIBUTING.md, don't be shy :)

Huge thanks to the contributors

Contact

Michel Tu:

License

MIT, see the LICENSE FILE

Note

This is a personal project and has nothing to do with my current employer (whoever that is) or a previous one (whoever that is).

reqlite's People

Contributors

neumino avatar threepointone avatar slava avatar simonratner avatar zephraph avatar ccheever avatar jimivdw avatar joeybaker avatar rclai avatar yamalight avatar bchavez avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.