@oberd/olive-middleware-koa
Oberd single sign on and services middleware for koa
Last updated 4 years ago by oberd .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @oberd/olive-middleware-koa 
SYNC missed versions from official npm registry.

Oberd Olive Middleware

Oberd single sign on and services middleware for koa

Installation:

npm install --save olive-middleware-koa

Middlewares:

env icons services session

Environment

Environment middleware provides access to server environment specific information, for building urls in the browser.

Routes

GET /env.js

Example Usage
var olive = require('olive-middleware-koa');
app.use(olive.env());
<script src="/env.js"></script>
<script>
// window.env is 
// 
// {
//     "env":"_demo",
//     "url":"http://{prefix}.oberd.dev/",
//     "cookieDomain":".oberd.dev"
// }
</script>

Icons

Requires session and services middleware

This plugin accesses the login service to pull the mobile media information for an institution, and respond with the appropriate images for favicon.ico, and apple-icon routes.

Routes

GET /apple-icon-[size]x[size].png

Where size is one of 180, 152, 120, 76, 32

Example Usage
var olive = require('olive-middleware-koa');
app.use(olive.session());
app.use(olive.services());
app.use(olive.icons());

Services

Provides proxy functionality, and attaches an sdk to the koa request object, so that you can pull in data and mash up before sending it back to the client.

Olive Configuration
{
    "services": {
        "login": {
            "url": "{oberd:login}"
        },
        "cpanel": {
            "url": "{oberd:cpanel}"
        }
    }
}
Service Usage from Browser

All login routes will be available from

/login/*

All cpanel routes will be available from

/cpanel/*

Service Usage from SDK
var olive = require('olive-middleware-koa');
app.use(olive.session());
app.use(olive.services());
app.use(function *() {
    // Proxy request out to login/session/person based on
    // olive.json
    var person = yield this.olive.login.get('/session/person');
    this.body = `Hi ${person.fullName}, welcome to Oberd Olive!`;
});

Current Tags

  • 1.4.2                                ...           latest (4 years ago)

9 Versions

  • 1.4.2                                ...           4 years ago
  • 1.4.1                                ...           4 years ago
  • 1.4.0                                ...           4 years ago
  • 1.3.2                                ...           4 years ago
  • 1.3.1                                ...           4 years ago
  • 1.3.0                                ...           5 years ago
  • 1.2.8                                ...           5 years ago
  • 1.2.7                                ...           5 years ago
  • 1.2.6                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 4
Dependencies (13)
Dev Dependencies (9)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |