Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/geut/moleculer-browser
Moleculer for the browser.
https://github.com/geut/moleculer-browser
browser distributed framework microservice microservices moleculer web
Last synced: 2 months ago
JSON representation
Moleculer for the browser.
- Host: GitHub
- URL: https://github.com/geut/moleculer-browser
- Owner: geut
- License: mit
- Created: 2019-07-23T22:00:56.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-13T12:32:09.000Z (about 4 years ago)
- Last Synced: 2024-10-02T16:20:59.589Z (3 months ago)
- Topics: browser, distributed, framework, microservice, microservices, moleculer, web
- Language: JavaScript
- Size: 2.69 MB
- Stars: 30
- Watchers: 5
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-moleculer - moleculer-browser - Moleculer for the browser. (Services / Others)
README
# moleculer-browser
[![Build Status](https://travis-ci.com/geut/moleculer-browser.svg?branch=master)](https://travis-ci.com/geut/moleculer-browser)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
![stability-experimental](https://img.shields.io/badge/stability-experimental-orange.svg)> [Moleculer](https://github.com/moleculerjs/moleculer) for the browser.
moleculer-browser is a wrapper on top of [Moleculer](https://github.com/moleculerjs/moleculer).
Most of the 90% of the Moleculer's codebase is platform agnostic.
Using [rollup](https://rollupjs.org/) we replaced the specific code for Node.js with
shims to simulate the original behaviour.```
$ npm install @geut/moleculer-browser
``````javascript
const { ServiceBroker } = require('@geut/moleculer-browser')const broker = new ServiceBroker({
transporter: { type: 'fake' },
serializer: 'Json',
logger: console
})broker.createService({
name: 'math',
actions: {
add (ctx) {
return Number(ctx.params.a) + Number(ctx.params.b)
}
}
})broker.start()
// Call service
.then(() => broker.call('math.add', { a: 5, b: 3 }))
.then(res => console.log('5 + 3 =', res))
.catch(err => console.error(`Error occured! ${err.message}`))
```### Glitch
### Codesandbox
[![Edit moleculer-browser](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/moleculer-browser-1tk71?fontsize=14)
When we talk about services we think at some point in a process running in some environment. Well, the browser is a process too.
What if the browser could provide a service itself through a network on top of WebSockets or WebRTC?
That's what we want to show here.
:bug: If you found an issue we encourage you to report it on [github](https://github.com/geut/moleculer-browser/issues). Please specify your OS and the actions to reproduce it.
:busts_in_silhouette: Ideas and contributions to the project are welcome. You must follow this [guideline](https://github.com/geut/moleculer-browser/blob/master/CONTRIBUTING.md).
## License
MIT © A [**GEUT**](http://geutstudio.com/) project