0.3.11 • Published 6 years ago

conveyor-client v0.3.11

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

Conveyor Client

This module provides a client to the Conveyor event sourcing engine's HTTP API. In order to use the subscriptions functionality, an adapter must be used for your web framework of choice.

Usage

const conveyor = require('../lib/index');

(async () => {
    const c = conveyor.Client('localhost', 3000, false)

    console.log('Creating feed: /basic')
    await c.createFeed('/basic')

    c.subscribe('/users', e => {
        console.log('I would be called if there was a subscription registration implementation')
    })
    
    const event1 = { type: 'basic', value: 42 }
    console.log(`Emitting event to /basic: ${JSON.stringify(event1)}`)
    await c.emitEvent('/basic', event1)

    console.log('Creating feed: /basic/sub-feed')
    await c.createFeed('/basic/sub-feed')

    const event2 = { type: 'basic', value: 17 }
    console.log(`Emitting event to /basic/sub-feed: ${JSON.stringify(event2)}`)
    await c.emitEvent('/basic/sub-feed', event2)

    console.log(`Getting events fom /basic`)
    const resp = await c.getEvents('/basic');
    console.log(JSON.stringify(resp.events, null, 3))
})();
0.3.11

6 years ago

0.3.10

6 years ago

0.3.9

6 years ago

0.3.8

6 years ago

0.3.7

6 years ago

0.3.6

6 years ago

0.3.5

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago