New github api page with a repo information example
Bootstrap-Well ios7 style
This commit is contained in:
4
app.js
4
app.js
@ -65,12 +65,12 @@ app.get('/api/foursquare', passportConf.ensureAuthenticated, api.getFoursquare);
|
|||||||
app.get('/api/tumblr', passportConf.ensureAuthenticated, api.getTumblr);
|
app.get('/api/tumblr', passportConf.ensureAuthenticated, api.getTumblr);
|
||||||
app.get('/api/facebook', passportConf.ensureAuthenticated, api.getFacebook);
|
app.get('/api/facebook', passportConf.ensureAuthenticated, api.getFacebook);
|
||||||
app.get('/api/scraping', api.getScraping);
|
app.get('/api/scraping', api.getScraping);
|
||||||
app.get('/api/github', api.getGithub);
|
app.get('/api/github', passportConf.ensureAuthenticated, api.getGithub);
|
||||||
app.get('/api/lastfm', api.getLastfm);
|
app.get('/api/lastfm', api.getLastfm);
|
||||||
app.get('/api/nyt', api.getNewYorkTimes);
|
app.get('/api/nyt', api.getNewYorkTimes);
|
||||||
app.get('/api/twilio', api.getTwilio);
|
app.get('/api/twilio', api.getTwilio);
|
||||||
app.get('/api/etsy', api.getEtsy);
|
app.get('/api/etsy', api.getEtsy);
|
||||||
app.get('/api/twitter', api.getTwitter);
|
app.get('/api/twitter', passportConf.ensureAuthenticated, api.getTwitter);
|
||||||
|
|
||||||
app.get('/contact', contact.getContact);
|
app.get('/contact', contact.getContact);
|
||||||
app.post('/contact', contact.postContact);
|
app.post('/contact', contact.postContact);
|
||||||
|
@ -8,7 +8,7 @@ var geoip = require('geoip-lite');
|
|||||||
var FB = require('fb');
|
var FB = require('fb');
|
||||||
var tumblr = require('tumblr.js');
|
var tumblr = require('tumblr.js');
|
||||||
var foursquare = require('node-foursquare')({ secrets: config.foursquare });
|
var foursquare = require('node-foursquare')({ secrets: config.foursquare });
|
||||||
|
var Github = require('github-api');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GET /api
|
* GET /api
|
||||||
@ -118,4 +118,47 @@ exports.getScraping = function(req, res) {
|
|||||||
user: req.user
|
user: req.user
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.getGithub = function(req, res) {
|
||||||
|
var token = _.findWhere(req.user.tokens, { kind: 'github' });
|
||||||
|
if (!token) {
|
||||||
|
return res.render('api/unauthorized', {
|
||||||
|
title: 'GitHub API',
|
||||||
|
provider: 'GitHub',
|
||||||
|
user: req.user
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// TODO: Fix rate limit on passport-github token
|
||||||
|
var github = new Github({ token: token.token });
|
||||||
|
var repo = github.getRepo('sahat', 'cloudbucket');
|
||||||
|
repo.show(function(err, repo) {
|
||||||
|
res.render('api/github', {
|
||||||
|
title: 'GitHub API',
|
||||||
|
repo: repo,
|
||||||
|
user: req.user
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.getTwilio = function(req, res) {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.getEtsy = function(req, res) {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.getNewYorkTimes = function(req, res) {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.getLastfm = function(req, res) {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.getTwitter = function(req, res) {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
"connect-flash": "*",
|
"connect-flash": "*",
|
||||||
"express": "*",
|
"express": "*",
|
||||||
"forever": "*",
|
"forever": "*",
|
||||||
|
"github-api": "*",
|
||||||
"request": "*",
|
"request": "*",
|
||||||
"geoip-lite": "*",
|
"geoip-lite": "*",
|
||||||
"jade": "*",
|
"jade": "*",
|
||||||
|
@ -497,14 +497,12 @@ label-info {
|
|||||||
.panel {
|
.panel {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
border: 0;
|
|
||||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.panel-default {
|
.panel-default {
|
||||||
> .panel-heading {
|
> .panel-heading {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border: 0;
|
|
||||||
color: #007aff;
|
color: #007aff;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
@ -518,6 +516,27 @@ label-info {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Wells =================================================================
|
||||||
|
.well {
|
||||||
|
padding: 15px 15px 5px;
|
||||||
|
border: 0;
|
||||||
|
background-color: rgba(0, 0, 0, 0.08);
|
||||||
|
margin-bottom: 0;
|
||||||
|
color: #555;
|
||||||
|
|
||||||
|
strong {
|
||||||
|
font-size: 85%;
|
||||||
|
color: #888;
|
||||||
|
border-bottom: 1px solid #c6c6c6;
|
||||||
|
display: block;
|
||||||
|
padding-bottom: 8px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Typography =================================================================
|
// Typography =================================================================
|
||||||
|
|
||||||
.page-header {
|
.page-header {
|
||||||
|
@ -5,24 +5,24 @@ block content
|
|||||||
|
|
||||||
ul.list-unstyled.lead
|
ul.list-unstyled.lead
|
||||||
li
|
li
|
||||||
a(href='/api/foursquare') Foursquare
|
a(href='/api/etsy') Etsy
|
||||||
li
|
|
||||||
a(href='/api/tumblr') Tumblr
|
|
||||||
li
|
li
|
||||||
a(href='/api/facebook') Facebook
|
a(href='/api/facebook') Facebook
|
||||||
|
li
|
||||||
|
a(href='/api/foursquare') Foursquare
|
||||||
|
li
|
||||||
|
a(href='/api/github') GitHub
|
||||||
li
|
li
|
||||||
a(href='/api/lastfm') Last.fm
|
a(href='/api/lastfm') Last.fm
|
||||||
li
|
li
|
||||||
a(href='/api/tokbox') Tokbox
|
a(href='/api/nyt') New York Times
|
||||||
li
|
li
|
||||||
a(href='/api/scraping') Web Scraping
|
a(href='/api/tumblr') Tumblr
|
||||||
li
|
li
|
||||||
a(href='/api/twitter') Twitter
|
a(href='/api/twitter') Twitter
|
||||||
li
|
li
|
||||||
a(href='/api/twilio') Twilio
|
a(href='/api/twilio') Twilio
|
||||||
li
|
li
|
||||||
a(href='/api/etsy') Etsy
|
a(href='/api/scraping') Web Scraping
|
||||||
li
|
|
||||||
a(href='/api/nyt') New York Times
|
|
||||||
li
|
|
||||||
a(href='/api/github') GitHub
|
|
||||||
|
44
views/api/github.jade
Normal file
44
views/api/github.jade
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
extends ../layout
|
||||||
|
|
||||||
|
block content
|
||||||
|
.page-header
|
||||||
|
h1
|
||||||
|
i.fa.fa-github
|
||||||
|
| GitHub API
|
||||||
|
.btn-group.btn-group-justified
|
||||||
|
a.btn.btn-lg.btn-primary(href='http://developer.github.com/guides/getting-started/', target='_blank')
|
||||||
|
i.fa.fa-check-square-o
|
||||||
|
| Getting Started
|
||||||
|
a.btn.btn-lg.btn-primary(href='https://apigee.com/console/github', target='_blank')
|
||||||
|
i.fa.fa-laptop
|
||||||
|
| API Console
|
||||||
|
a.btn.btn-lg.btn-primary(href='http://developer.github.com/v3/', target='_blank')
|
||||||
|
i.fa.fa-code-fork
|
||||||
|
| Documentation
|
||||||
|
|
||||||
|
.panel.panel-default
|
||||||
|
.panel-heading
|
||||||
|
h3.panel-title Repository Information
|
||||||
|
.panel-body
|
||||||
|
.row
|
||||||
|
.col-xs-4
|
||||||
|
img.img-rounded.img-responsive(src='https://github.global.ssl.fastly.net/images/modules/logos_page/Octocat.png')
|
||||||
|
.col-sm-6.col-md-8
|
||||||
|
h4
|
||||||
|
a(href='#{repo.html_url}') #{repo.name}
|
||||||
|
p
|
||||||
|
.btn.btn-sm.btn-primary-outline
|
||||||
|
i.fa.fa-eye-slash
|
||||||
|
| Watchers: #{repo.watchers_count}
|
||||||
|
.btn.btn-sm.btn-primary-outline
|
||||||
|
i.fa.fa-star
|
||||||
|
| Starred: #{repo.stargazers_count}
|
||||||
|
.btn.btn-sm.btn-primary-outline
|
||||||
|
i.fa.fa-code-fork
|
||||||
|
| Forks: #{repo.forks_count}
|
||||||
|
.btn.btn-sm.btn-primary-outline
|
||||||
|
i.fa.fa-code
|
||||||
|
| #{repo.language}
|
||||||
|
.well
|
||||||
|
strong DESCRIPTION
|
||||||
|
p= repo.description
|
@ -17,7 +17,7 @@ block content
|
|||||||
img(src='/img/hacker_news.png', width=50, height=50)
|
img(src='/img/hacker_news.png', width=50, height=50)
|
||||||
span Hacker News Frontpage
|
span Hacker News Frontpage
|
||||||
|
|
||||||
table.table.table-condensed.table-hover
|
table.table.table-condensed
|
||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
th №
|
th №
|
||||||
|
Reference in New Issue
Block a user