IsoProxy - General Isomorphic API Proxy
IsoProxy is a simple proxy inspired Fetchr, and the motivation is the same as in Fetchr.
Features
- Isolation from a web application framework by adopting JSONRPC.
- ES6 friendly with Promise.
Install
npm install isoproxy --save
Usage
Define isomorphic API:
// proxy.jsvar IsoProxy = ; var proxy = root: "/api" isServer: typeof window === "undefined"; proxy; proxy; moduleexports = proxy;
Server side (express):
// server.jsvar express = ;var bodyParser = ;var proxy = ; var app = ;app; Object; app;
Client side (browserify):
// client.jsvar proxy = ; proxyapimath; proxyapimath;
Why interfaces and implementations are separated?
It is because the client side need not know implementation details. In other words, implementations can be hidden from users.
Please see this example for more information.
Examples
Links
- koa-isoproxy
- koa middleware for IsoProxy.
Supported Browsers
Above Internet Explorer 9 and other modern browsers.
License
The MIT License.