Tutorial: Quickstart for Node.js

JavaScript Quickstart for Node.js

1. Create a Webcom application on the Webcom developer console

2. Install Webcom SDK using npm

npm install webcom@3.3.0

3. In your application code

3.a Import the Webcom SDK Node.js library
const Webcom = require('webcom');
3.b Use the Webcom SDK

The API is similar to the Webcom SDK for web applications.
For example (replace “<your-app>” with your actual application identifier):

const app = Webcom.App('<your-app>');
const rootNode = app.serverlessDb.rootNode;
// Read data
    .then(snapshot => console.info("the data is now:", snapshot.val()));
// Write data
rootNode.set({foo: 'bar'});

4. Run your application

If you run your application behind a company proxy, you just have to set up usual environment variables https_proxy and http_proxy (or their uppercase counterparts):

export https_proxy="my-proxy.my-company.com:8080"

Note that the no_proxy environment variable is also taken into account.