Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/airtoxin/elekiter
express like electron ipc wrapper library
https://github.com/airtoxin/elekiter
Last synced: about 9 hours ago
JSON representation
express like electron ipc wrapper library
- Host: GitHub
- URL: https://github.com/airtoxin/elekiter
- Owner: airtoxin
- License: mit
- Created: 2015-11-11T06:33:57.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-04-08T04:01:23.000Z (over 8 years ago)
- Last Synced: 2024-10-03T16:36:10.724Z (about 1 month ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# elekiter [![Build Status](https://travis-ci.org/airtoxin/elekiter.svg)](https://travis-ci.org/airtoxin/elekiter) [![npm version](https://badge.fury.io/js/elekiter.svg)](http://badge.fury.io/js/elekiter)
express like electron ipc wrapper library## Install
`$ npm install elekiter`
## Usage
In __browser process__ (Main Process)
```js
var Elekiter = require('elekiter');
var elekiter = new Elekiter();// regist middleware
elekiter.use(function (req, res, next) {
req.param = req.params[0];
next();
});
// routing
elekiter.get('/', function (req, res) {
var message = 'Hi! ' + req.param; // req.param was set by middleware
var life = req.params[1];if (life === 'human') return res.ok(message);
if (life === 'alien') return res.ng('can not communicate');
res.ng('unknown life');
});
```In __renderer process__
```js
var Elekiter = require('elekiter');
var elekiter = new Elekiter();elekiter.request('/', 'John', 'human').then(function (message) {
console.log('@message:', message);
}).catch(function (error) {
console.log('@error:', error);
});
```