Skip to content

dev-chain/cloud-api

 
 

Repository files navigation

Wakanda Service


This service was created to help developers a register statistic of use of your applications, like crm, erp, mobile, apps, etc.

Its simple

Have two ways to communicate with wakanda:

POST -> /listStatistic

"client": "",
"token": ""

Send '*' to list all statistics;
Send "client code" to list all statistics by this client;

POST -> /registerStatistic

JSON FORMAT

"client": "",
"module": "",
"submodule": "",
"title": "",
"linkClicked": "",
"token": ""

*For now its a fixed layout to register statistics;

To init server just clone and run npm start

API Usage

Import this scripts on your HTML page

<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.js"></script><br>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/aes.js"></script><br>
<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script><br>
<script src="https://cdn.jsdelivr.net/gh/lucasventurasc/wakanda@v1.1/webapi/wakanda.js"></script><br>

Instance Wakanda as global variable

This will bind your DOM Elements with ".wakanda" class to fire statistic register when clicked
Wakanda expect password, token and server in your constructor;

<button class="wakanda">Save</button>
//Password must be 8 characters in length because aes256 encrypt
var password = function() {
    return '12345678';
};

//Token its a any word you want, its be used to verify if token received was valid to server
var token = function() {
    return 'abcdeifghyjklmnopqrstuvxz';
};

//password and token must be a callback function, its a design pattern to prevent you from cache the password and token on your
//page, you must get then of your server when you need it

//You need to set the general wakanda data in this moment too like, client, module, submodule and title;
var wakanda = new Wakanda(password, token, 'http://yourwakandaserver.com'); //Server URL to call
wakanda.client = '7894';
wakanda.module = 'Some Module';
wakanda.submodule = 'Some Submodule';
wakanda.title = 'Some Title';

//Wakanda by default will get property 'alt' of your element and will set as the linkClicked property, 
//if alt property does not exists will get innerHTML;

Security Tips

Currently this app works without any change just with the Redis Cloud , if want will use other Redis Service, you need config this manually.

About

Chain ID develop service in Cloud PRO.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 95.6%
  • CSS 2.9%
  • HTML 1.5%