mirror of https://github.com/embarklabs/embark.git
Framework for serverless Decentralized Applications using Ethereum, IPFS and other platforms
https://framework.embarklabs.io/
64d8fa3368
So far, `ProcessManager` was able to only register a `process:launch` handler. There was no way to tell `ProcessManager` how to stop processes. This hasn't been a problem so far as most of the service processes can be started without the usage of the `ProcessManager`, but turns out to be necessary if we want Embark UI to be able to pick up running services. A good example is the webserver process, which until now bypasses the `ProcessManager` all together. The webserver sets up two event handlers to start and stop it respectively: ``` this.events.setCommandHandler('start-webserver', () => this.server.start()); this.events.setCommandHandler('stop-webserver', () => this.server.stop()); ``` In the future, this should happen through the `ProcessManager` instead, so the webserver process can be picked up by Embark UI, like this: ``` this.request('process:register', 'webserver', () => { this.server.start(); }); // and then this.request('process:launch', 'webserver', () => { // server started }); ``` Notice that the given callback to registering a process is actually the function that gets called to launch the process. Having that in mind, and considering that we also need a way to stop the process through `ProcessManager, so we don't introduce a regression, we need a way to register a stop call back as well. The new API introduced in this commit looks like this: ``` this.request('process:register', 'webserver', { launchFn: (callback) => { this.server.start(callback) }, stopFn: (callback) => this.server.stop(callback) } }); // and then this.request('process:launch', 'webserver', (err, message, port) => { // server started }); this.request('process:stop', 'webserver', err => { // server stopped }); ``` Notice that `process:register` works exactly the same way as before as well. Another thing to notice is that all parameters emitted by the underlying process are propagated to the outside caller, which is why `err`, `message` and `port` are available inside the launch callback. |
||
---|---|---|
.github | ||
bin | ||
cmd | ||
embark-ui | ||
lib | ||
locales | ||
templates | ||
test | ||
test_apps | ||
.codeclimate.yml | ||
.editorconfig | ||
.eslintignore | ||
.eslintrc.json | ||
.gitignore | ||
.npmignore | ||
.npmrc | ||
.nycrc | ||
.travis.yml | ||
CONTRIBUTING.md | ||
LICENSE | ||
README.md | ||
appveyor.yml | ||
header.png | ||
logo.png | ||
package-lock.json | ||
package.json |
README.md
What is Embark
Embark is a framework that allows you to easily develop and deploy Decentralized Applications (DApps).
A Decentralized Application is a serverless html5 application that uses one or more decentralized technologies.
Embark currently integrates with EVM blockchains (Ethereum), Decentralized Storages (IPFS), and Decentralized communication platforms (Whisper and Orbit). Swarm is supported for deployment.
With Embark you can:
Blockchain (Ethereum)
- Automatically deploy contracts and make them available in your JS code. Embark watches for changes, and if you update a contract, Embark will automatically redeploy the contracts (if needed) and the dapp.
- Contracts are available in JS with Promises.
- Do Test Driven Development with Contracts using Javascript.
- Keep track of deployed contracts; deploy only when truly needed.
- Manage different chains (e.g testnet, private net, livenet)
- Easily manage complex systems of interdependent contracts.
Decentralized Storage (IPFS)
- Easily Store & Retrieve Data on the DApp through EmbarkJS. Including uploading and retrieving files.
- Deploy the full application to IPFS or Swarm.
Decentralized Communication (Whisper, Orbit)
- Easily send/receive messages through channels in P2P through Whisper or Orbit.
Web Technologies
- Integrate with any web technology including React, Foundation, etc..
- Use any build pipeline or tool you wish, including grunt, gulp and webpack.
$ npm -g install embark