app
appbasejs
npm i appbasejs
Deprecated!
https://www.npmjs.com/package/appbase-js is the currently maintained version of the library, and should be used instead.
app

appbasejs

JavaScript library for Appbase [Appbase.io](http://appbase.io) Current Version: 2.2.17

by Appbase

2.2.17 (see all)TypeScript:Not Found
npm i appbasejs
Readme

AppbaseJS

JavaScript library for Appbase Appbase.io Current Version: 2.2.17

Get Appbase

Node: npm install appbasejs

Browser: https://cdn.appbase.io/2.0/appbase.js

Dev

Do npm install inside the folder to install devDependencies.

Browser Build

Distribution build

npm run-script build: creates ./dist/appbase.min.js

Test build

npm run-script test_build: creates ./build/appbase.js this build exposes internal server methods, and allows running tests on them in the browser.

Testing

npm test for node.

Goto /test/browser/index.html for browser tests. If there's a test build, it will also run tests on internal server methods as well, otherwise will run tests only on interface methods.

Play

Node:

Appbase = require('appbasejs');

Browser:

<script src="./dist/appbase.min.js"></script>

Put Credentials

Appbase.credentials('app','secret');

Appbase references

Now let's create two Appbase references under namespaces "user" and "tweets".

var userRef = Appbase.ns("user").v("andy");
var tweetRef = Appbase.ns("tweet").v(Appbase.uuid());

As seen here, one can optionally specify the reference name.

Working with Data

userRef.setData({
    status: "sudo",
    location: "Belo Horizonte, Brazil"
});
tweetRef.setData({
    message: "Remember Red, hope is a good thing."
});

Now let's add the tweet as an edge to our user reference.

userRef.setEdge(tweetRef, 'tweeted');

Go real-time!

Listen to the changes on the user reference data properties and edges, to see the changes we have made so far.

userRef.on('properties', function(error, ref, userSnap) {
    console.log(userSnap.properties().status);
    console.log(userSnap.properties().location);
});
userRef.on('edge_added', function(error, edgeRef, eSnap) {
    edgeRef.on('properties', function(error, ref, tweetSnap) {
        console.log(tweetSnap.properties().message);
    });
});
Appbase.ns('tweet').search({text:'hello', properties: ['message']},function(err, array) {
    console.log(array);
})

Downloads/wk

12

GitHub Stars

0
No data available

LAST COMMIT

NaNyrs ago

MAINTAINERS

1

CONTRIBUTORS

0

OPEN ISSUES

0

OPEN PRs

0
No data available
VersionTagPublished
2.2.17
latest
7yrs ago
No alternatives found
No tutorials found
Add a tutorial