0.0.9 • Published 4 years ago

yar-node v0.0.9

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

yar-node

✨ Features:

Server

const { YarServer } = require('yar-node');

class API {
  someMethod(args) {}
}

const server = new YarServer(new API());

server.handle();

Client

const { YarClient } = require('yar-node');

const client = new YarClient('http://host/api/');

client.call('someMethod', { name: 'Chris' }).then(res => {
  console.log(`reponse:${res}`);
});

Yar Header

typedef struct _yar_header {
  unsigned int   id;            // transaction id
  unsigned short version;       // protocl version
  unsigned int   magic_num;     // default is: 0x80DFEC60
  unsigned int   reserved;
  unsigned char  provider[32];  // reqeust from who
  unsigned char  token[32];     // request token, used for authentication
  unsigned int   body_len;      // request body len
}

Request

{
  i: '', // transaction id
  m: '', // the method which being called
  p: {} // parameters
}

Response

{
  i: '', // transaction id
  s: '', // status
  r: '', // return value
  o: '', // output
  e: ''  // error or exception
}
0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago