@oberd/olive-middleware-koa
v1.4.2
Published
Oberd single sign on and services middleware for koa
Downloads
2
Readme
Oberd Olive Middleware
Oberd single sign on and services middleware for koa
Installation:
npm install --save olive-middleware-koa
Middlewares:
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!`;
});