Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

Commit

Permalink
Better readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
hperrin committed Oct 26, 2017
1 parent b271838 commit 892f527
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 16 deletions.
45 changes: 35 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
# <img alt="logo" src="https://raw.githubusercontent.com/sciactive/2be-extras/master/logo/product-icon-40-bw.png" align="top" /> 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:
<div dir="rtl">Quick Setup with NPM</div>

```
npm install --save nymph-client-node
```sh
npm install --save nymph-client
```

To use, require it as the Nymph object:
Expand All @@ -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
});
```
Expand All @@ -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).
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -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"
}
Expand Down

0 comments on commit 892f527

Please sign in to comment.