Tutorial: Quickstart for Node.js

JavaScript Quickstart for Node.js

1. Create your own developer account on the Webcom developer console

2. Create a Webcom application on the Webcom developer console

3. Install Webcom SDK using npm

npm install webcom@2.8

4. In your application code

4.a Import the Webcom SDK Node.js library
const Webcom = require('webcom');
4.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 myRef = new Webcom('<your-app>');
// Read data
myRef.on("value", function(snap) {
    console.info("the data is now:", snap.val());
});
// Write data
myRef.set({foo: 'bar'});

5. Run your application

If you run your application behind a company proxy, you just have to setup usual environment variables HTTPS_PROXY and HTTP_PROXY (or their lowercase counterparts):

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