apps-a-middleware
v1.2.2
Published
![image](https://github.com/intermine/apps-a-middleware/raw/master/pear.png)
Downloads
14
Readme
#Apps/A Middleware (Node.js) ##Codename "Pear"
A Node.js reference implementation of a middleware for loading and rendering Apps.
##Quickstart
$ npm install
$ PORT=1234 node example/index.js
And then visit 127.0.0.1:1234.
##Connect Middleware
#!/usr/bin/env coffee
http = require 'http'
connect = require 'connect'
middleware = require '../middleware.coffee'
app = connect()
.use(middleware
'apps': [
'git://github.com/intermine/intermine-apps-a.git'
]
'config': __dirname + '/config.json'
)
.use(connect.static(__dirname + '/public'))
http.createServer(app).listen process.env.PORT
The middleware accepts two params. One, apps
, is an Array of paths to app sources. This can be any of the following:
- Git paths on the net like:
git://github.com/intermine/intermine-apps-a.git
- Local file paths:
file:///home/dev/intermine-apps-a
The other parameter, config
, represents the configuration you want merged with the config from the apps sources. This can be one of the following:
- Local file path:
file:///home/dev/example-middleware/config.json
- A plain JS Object.
Only the first parameter is required.
Then, the middleware provides you with two routes:
- GET
/middleware/apps/a
- which gives you a config for all the apps it can serve - GET
/middleware/apps/a/:appId
- which returns one app
Both URLs are being used internally by the Apps client (see example/public/js/intermine.fatapps.js
).