Skip to content

Commit

Permalink
first commit. sorry, this is too larrge commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
KOBA789 committed Jan 8, 2012
0 parents commit f820821
Show file tree
Hide file tree
Showing 19 changed files with 162 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
@@ -0,0 +1 @@
Some text.
6 changes: 6 additions & 0 deletions lib/apis/authorize.js
@@ -0,0 +1,6 @@
var oauth = require('oauth-revenge');

module.exports.index = function (req, res) {

res.end('login');
};
3 changes: 3 additions & 0 deletions lib/apis/callback.js
@@ -0,0 +1,3 @@
module.exports.index = function (req, res) {

};
9 changes: 9 additions & 0 deletions lib/apis/filters.js
@@ -0,0 +1,9 @@
var filters = module.exports;

filters.index = function (req, res) {

};

filters.show = function (req, res) {

};
7 changes: 7 additions & 0 deletions lib/apis/index.js
@@ -0,0 +1,7 @@
var apis = module.exports;

apis.authorize = require('./authorize');
apis.callback = require('./callback');

apis.statuses = require('./statuses');
apis.filters = require('./filters');
Empty file added lib/apis/statuses.js
Empty file.
5 changes: 5 additions & 0 deletions lib/config.js
@@ -0,0 +1,5 @@
module.exports.set = function (config) {
for (var key in config) {
module.exports[key] = config[key];
}
};
4 changes: 4 additions & 0 deletions lib/config.json
@@ -0,0 +1,4 @@
{
"LISTEN_PORT": "3000",
"MONGODB": "mongodb://localhost/test_db"
}
28 changes: 28 additions & 0 deletions lib/consumerkey.js
@@ -0,0 +1,28 @@
var Keychain = require('./schemata').Keychain;

var noop = function () {};

module.exports.init = function (name, callback) {
name = name || 'default';
Keychain.findOne({ name: name }, function (err, keychains) {
if (err) { throw err; }
module.exports.key = keychains.key;
module.exports.secret = keychains.secret;
process.nextTick(callback || noop);
});
};

module.exports.tie = function (name, key, secret) {
var keychain = new Keychain({
name: name,
key: key,
secret: secret
});

keychain.save(function (err) {
if (err) { throw err; }
});
};

module.exports.key = '';
module.exports.secret = '';
14 changes: 14 additions & 0 deletions lib/index.js
@@ -0,0 +1,14 @@
var config = require('./config.json');

var router = require('router').create();
var consumerkey = require('./consumerkey');
var apis = require('./apis');
var routes = require('./routes');

function init() {
consumerkey.init();
routes.setup(router, apis);
router.listen(config.LISTEN_PORT);
}

init();
2 changes: 2 additions & 0 deletions lib/keychain.js
@@ -0,0 +1,2 @@
var Model = require('LazyBoy');

16 changes: 16 additions & 0 deletions lib/routes.js
@@ -0,0 +1,16 @@
module.exports.setup = function (router, apis) {
router.get('/', function(req, res) {
res.writeHead(200);
var result = { message: 'Welcome to Read Fav Later!' };
res.end(JSON.stringify(result));
});

router.get('/authorize', apis.authorize.index);
router.get('/callback', apis.callback.index);

router.get('/statuses', apis.status.index);
router.get('/statuses/{item}', apis.status.show);

router.get('/filters', apis.filters.index);
router.get('/filters/{filter}', apis.filters.index);
};
23 changes: 23 additions & 0 deletions lib/schemata.js
@@ -0,0 +1,23 @@
var config = require('./config.json');

var mongoose = require('mongoose');
mongoose.connect(config.MONGODB);
var Schema = mongoose.Schema,
ObjectId = Schema.ObjectId;

var User = new Schema({
screen_name: String,
twitter_uid: Number,
token: String,
accessToken: String
});
module.exports.User =
mongoose.model('User', User);

var ConsumerKey = new Schema({
name: String,
key: String,
secret: String
});
module.exports.Keychain =
mongoose.model('ConsumerKey', ConsumerKey);
3 changes: 3 additions & 0 deletions lib/session.js
@@ -0,0 +1,3 @@
module.exports.getSession = function (req) {

};
7 changes: 7 additions & 0 deletions lib/tie.js
@@ -0,0 +1,7 @@
var consumerkey = require('./consumerkey');

consumerkey.tie(
'default',
'Q4ibSu9XhXvm21UVDbT4A',
'9wXAUMrwZNaeVJlsf6twNtAAe9Y41XX876ZKsHtuU'
);
9 changes: 9 additions & 0 deletions lib/twitter_auth.js
@@ -0,0 +1,9 @@
module.exports = (function () {
function TwitterAuth () {

}



return TwitterAuth;
})();
18 changes: 18 additions & 0 deletions package.json
@@ -0,0 +1,18 @@
{
"author": "KOBA789 <kobahide789@gmail.com> (http://koba789.com/)",
"name": "read_fav_later",
"version": "0.0.0",
"repository": {
"url": ""
},
"engines": {
"node": "~0.6.6"
},
"dependencies": {
"mongoose": "*",
"should": "*",
"oauth-revenge": "*",
"router": "*"
},
"devDependencies": {}
}
4 changes: 4 additions & 0 deletions test/mocha.opts
@@ -0,0 +1,4 @@
--require should
--reporter spec
--ui bdd
--growl
3 changes: 3 additions & 0 deletions test/test.coffee
@@ -0,0 +1,3 @@
###
# ユーザー認証
#

0 comments on commit f820821

Please sign in to comment.