diff --git a/README.md b/README.md index 4bee559..56e14c0 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,29 @@ -# logo Nymph - Node Client Files +# Nymph Node Client - collaborative app data -This repository contains the node client files required by Nymph. For a directory of all official Nymph repositories, check out the [main Nymph repository](https://github.com/sciactive/nymph). +[![Latest Stable Version](https://img.shields.io/npm/v/nymph-client-node.svg?style=flat)](https://www.npmjs.com/package/nymph-client-node) [![License](https://img.shields.io/npm/l/nymph-client-node.svg?style=flat)](https://www.npmjs.com/package/nymph-client-node) [![Open Issues](https://img.shields.io/github/issues/sciactive/nymph-client-node.svg?style=flat)](https://github.com/sciactive/nymph-client-node/issues) -## Nymph Node Client +Nymph is an object data store that is easy to use in JavaScript and PHP. -The Nymph client requires some browser globals that Node doesn't provide, so this repository sets up some globals to provide them. +## Installation + +You can install Nymph Node Client with NPM. + +```sh +npm install --save nymph-client-node +``` + +This repository is the JavaScript client for Node. There is also a **[browser client](https://github.com/sciactive/nymph-client)**. For more information, you can see the [main Nymph repository](https://github.com/sciactive/nymph). + +The Nymph client requires some browser globals that Node doesn't provide, so this client sets up some globals to provide them. It also sets up Nymph.init to also call PubSub.init with your configs, so you don't need to set up PubSub yourself. -## How to Install and Use Nymph in Node +## Setting up Nymph in Node.js -To install, use npm: +
Quick Setup with NPM
-``` -npm install --save nymph-client-node +```sh +npm install --save nymph-client ``` To use, require it as the Nymph object: @@ -26,8 +36,8 @@ Then provide the options to Nymph.init: ```js Nymph.init({ - restURL: 'http://...', - pubsubURL: 'ws://...', + restURL: 'https://yournymphrestserver/path/to/your/rest.php', + pubsubURL: 'wss://yournymphpubsubserver:8080', rateLimit: 100 }); ``` @@ -38,4 +48,19 @@ Now include your entity classes, such as `Todo`, and you can write queries and s Nymph.getEntities({'class': Todo.class}, {'type': '&', 'strict': ['name', 'Foobar']}).subscribe((todos) => { console.log("\nNew Foobar Todo Updates: ", todos); }); + +const myTodo = new Todo(); +myTodo.set({ + name: "Foobar", + done: false +}); +myTodo.save().then(() => { + alert("You've got new todos!"); +}); ``` + +For a thorough step by step guide to setting up Nymph on your own server, visit the [Setup Guide](https://github.com/sciactive/nymph/wiki/Setup-Guide). + +## Documentation + +Check out the documentation in the wiki, [Technical Documentation Index](https://github.com/sciactive/nymph/wiki/Technical-Documentation). diff --git a/index.js b/index.js index 5034628..5490965 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,8 @@ +// Nymph Node Client + +// (really, it's just the browser client with some Node libraries to supply fake +// browser globals.) + // Do aliases to get around Node modules. const nymphPath = require.resolve('nymph-client').replace(/lib\/Nymph(?:\.js)?$/, ''); const alias = require('module-alias'); diff --git a/package-lock.json b/package-lock.json index 973adaa..88c1a20 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "nymph-client-node", - "version": "0.0.1-alpha2", + "version": "0.0.1-alpha3", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -33,9 +33,9 @@ "integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=" }, "nymph-client": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/nymph-client/-/nymph-client-1.6.1.tgz", - "integrity": "sha512-qG6chFfc5v6rmVZJ3K1KoBG18TdrZVUTsinZeqpmzHK6gxfm203Mi6B8itqWn2Pa+wyIW/77IiVr3IMLOql+tw==" + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/nymph-client/-/nymph-client-2.2.0.tgz", + "integrity": "sha512-LUm8YdCzU9l71meVp8/Ymff4DHKokNCzcRyT63s5GNjw5QuPh6Tl72h5lFQDNFZD9+iyQWWuR31L+E83+92P1A==" }, "typedarray-to-buffer": { "version": "3.1.2", diff --git a/package.json b/package.json index 7e04c52..01c84d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nymph-client-node", - "version": "0.0.1-alpha2", + "version": "0.0.1-alpha3", "description": "A client wrapper for using Nymph in Node.js.", "main": "index.js", "scripts": { @@ -21,7 +21,7 @@ "homepage": "https://github.com/sciactive/nymph-client-node#readme", "dependencies": { "module-alias": "^2.0.1", - "nymph-client": "^1.6.1", + "nymph-client": "^2.2.0", "websocket": "^1.0.24", "xmlhttprequest": "^1.8.0" }