ravekit
v1.0.10
Published
RaveKit for RaveCat
Downloads
2
Readme
RaveKit
NodeJS Microservices on Redis Pub/Sub
npm install --save ravekit
Example
Watcher
import redis from 'redis';
import { Watcher } from 'ravekit';
const AppWatcher = new Watcher({
subscriber: redis.createClient(),
publisher: redis.createClient()
});
Service: Music
import redis from 'redis';
import { Service } from 'ravekit';
const App = new Service({
serviceName: 'Music',
subscriber: redis.createClient(),
publisher: redis.createClient(),
methodsAPI: {
getTrack({ trackId }) {
return { id: 1, title: 'Noisia - Mantra' };
}
}
});
Service: Test
import redis from 'redis';
import { Service } from 'ravekit';
const App = new Service({
serviceName: 'Test',
subscriber: redis.createClient(),
publisher: redis.createClient()
});
App.query('Music', 'getTrack', { trackId: 1 }).then(track => {
console.log(track);
});