0.0.3 • Published 11 years ago

trello_baseapp v0.0.3

Weekly downloads
16
License
-
Repository
github
Last release
11 years ago

Trello base app

Trello base app is an express squeleton to create apps on top of trello.

It provides:

  • trello login
  • trello deauthorization
  • session store in redis
  • API access to trello via Backbone models

Install

npm install trello_baseapp

Usage

Get the express app

To get the basic express app, you have to provide a config object:

var config = {
  "trello": {
    "token": {
    "name": "Your app name",
    "expiration": "never",
    "scope": "read,write"
  },
  "key": "",
  "secret": ""
  }
};

var app = require('trello_baseapp/lib/app')(config);

Login user

To log a user, redirect it to /login.

Using models

If a user if logged-in, you can use some backbone models via the request parameter.

app.get('/me', function(req, res) {
    var boards = req.trello.Boards();
    boards.fetch({
        success: function() {
            res.send('ok');
        },
        error: function() {
            res.send('error', 500);
        }
    });
});

License

(c) 2012 François de Metz

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.