Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
278 commits
Select commit Hold shift + click to select a range
418a4ec
add trump pic
patSSFC Apr 14, 2016
1309e7f
fixed merge conflicts. Pat sucks
muddybeard210 Apr 14, 2016
33b6fe9
deleted styles.css
muddybeard210 Apr 14, 2016
4d6449c
adjusted body in css
muddybeard210 Apr 14, 2016
30170c6
Merge pull request #17 from patSSFC/i-3-searchBar
patSSFC Apr 14, 2016
d005b0b
fleshing out html for politician view
patSSFC Apr 14, 2016
9f260a1
finish general info section
patSSFC Apr 14, 2016
afe1970
final changes to db-init. all records uploaded
tlwirtz Apr 14, 2016
cc0913c
update server to accept rudimentary query params
tlwirtz Apr 14, 2016
f127404
typo fix and readme
tlwirtz Apr 14, 2016
e26a27c
Update with comments about env vars
tlwirtz Apr 14, 2016
86aa972
Merge pull request #18 from patSSFC/i-3-setup-db
patSSFC Apr 14, 2016
5a1416f
Merging i-3-setupDB into dev
patSSFC Apr 14, 2016
765b3da
Merge branch 'dev' of https://github.com/patSSFC/con-tracker into dev
patSSFC Apr 14, 2016
805836d
Merge branch 'dev' into i-9-poliView
patSSFC Apr 14, 2016
2a76e6b
add express proxy module to make API calls
tlwirtz Apr 14, 2016
6845429
proxy for sunlight foundation
tlwirtz Apr 14, 2016
57ad427
prelim method for open secrets
tlwirtz Apr 14, 2016
bda9e25
built open secrets proxy, but not wokring
tlwirtz Apr 15, 2016
3a9b569
remove border from figure, add test-data/ to gitignore for testing
patSSFC Apr 15, 2016
95c641e
add test-request.js to gitignore
patSSFC Apr 15, 2016
a4d0480
open secrets now working
tlwirtz Apr 15, 2016
fad725c
update with openstates api from sunlight
tlwirtz Apr 15, 2016
32bdf23
fix load issue with static pages in server.js, create Filings object
patSSFC Apr 15, 2016
08436e9
udpate with sunlight foundation finance api
tlwirtz Apr 15, 2016
0ce466e
udpate README and typof fixes
tlwirtz Apr 15, 2016
75c3fad
make API call that returns member's voting history. Filters bills by …
Apr 15, 2016
2d2d718
filtered bills by whether they were On Passage. Returns array of obje…
Apr 15, 2016
d3221ec
get chart.js working locally, corresponding files are being ignored
patSSFC Apr 15, 2016
0269552
created helper function to populate each object in the bill array
Apr 15, 2016
cdc6564
add comments
Apr 15, 2016
66e2dc8
Merge pull request #20 from patSSFC/i-14-api-module
patSSFC Apr 17, 2016
1377400
modify doughnut size, add bioView.js
patSSFC Apr 17, 2016
2bae703
Merge branch 'dev' of https://github.com/patSSFC/con-tracker into dev
patSSFC Apr 17, 2016
707df2d
Merge branch 'dev' into i-9-poliView
patSSFC Apr 17, 2016
ea810ad
create overview file
Apr 17, 2016
9627364
Merge branch 'dev' of https://github.com/patSSFC/con-tracker into dev
Apr 17, 2016
d752f60
refactor out proxies into separate module
tlwirtz Apr 17, 2016
892db03
new york times requires an 'api-key' instead of 'apikey'
tlwirtz Apr 17, 2016
efa67af
update with nyt information
tlwirtz Apr 17, 2016
b6e108d
Merge pull request #22 from patSSFC/i-21-nyt-api
tlwirtz Apr 17, 2016
50cc663
foundation for handlebar templates
tlwirtz Apr 17, 2016
fa6b5da
scaffold out views, controllers and index
tlwirtz Apr 17, 2016
683365b
make api call to sunlight for bio information
Apr 17, 2016
5b73c8f
move ajax calls to bioController and chart.js to bioViews
patSSFC Apr 17, 2016
d9b8207
add function to accept fecID
Apr 17, 2016
3fbd391
get update
Apr 17, 2016
6bd9394
remove api param from api url
Apr 17, 2016
6d6c026
Merge pull request #23 from patSSFC/i-14-Overview-API-Call
tlwirtz Apr 17, 2016
be2a886
Merge pull request #24 from patSSFC/i-14-Vote-API-Call
tlwirtz Apr 17, 2016
f977e61
update index and scripts ... still not working correctly
tlwirtz Apr 17, 2016
0176f33
Merge branch 'dev' of https://github.com/patSSFC/con-tracker into i-1…
tlwirtz Apr 17, 2016
1bd0f3d
votes.js because votingController.js
tlwirtz Apr 17, 2016
6ec8112
finance api requires double '/' for some stupid reason
tlwirtz Apr 17, 2016
d04dfd5
resolve overview merge conflicts
Apr 17, 2016
9d768f1
finish get requests through proxy, working on politician view template
patSSFC Apr 17, 2016
be67e45
Merge pull request #25 from patSSFC/i-11-votes-view
tlwirtz Apr 17, 2016
0bb156d
Merge branch 'dev' of https://github.com/patSSFC/con-tracker into dev
Apr 17, 2016
6848252
remove api key from url
tlwirtz Apr 17, 2016
a4e0363
update template with contributor names
patSSFC Apr 17, 2016
d662c16
must close h2 tag or nothing works
tlwirtz Apr 17, 2016
b6ceee4
Merge branch 'dev' into i-9-poliView
tlwirtz Apr 17, 2016
895e1d0
Merge branch 'i-9-poliView' into dev
tlwirtz Apr 17, 2016
ba78916
solve merge conflict
tlwirtz Apr 17, 2016
bc923c1
view working properly. needs some UX love
tlwirtz Apr 17, 2016
d99e6b1
add bio templating
Apr 17, 2016
5f51620
fix merge conflicts in styles/
patSSFC Apr 17, 2016
d1cd088
Merge branch 'i-11-votes-view' into dev
patSSFC Apr 17, 2016
5cd4392
remove remnants of merge conflict
tlwirtz Apr 17, 2016
dea3a62
Merge pull request #28 from patSSFC/random-fix
tlwirtz Apr 17, 2016
70c85f6
update naming conventions
Apr 17, 2016
75ad29b
Merge branch 'dev' of https://github.com/patSSFC/con-tracker into dev
Apr 17, 2016
623f59c
add title and fonts
tlwirtz Apr 17, 2016
4059597
update css fonts
tlwirtz Apr 17, 2016
f6cc8fb
rename file to avoid merge conflict
Apr 17, 2016
13c9bdc
remove old bioView file
Apr 17, 2016
63aa38f
Merge pull request #31 from patSSFC/i-9-Overview-View
patSSFC Apr 17, 2016
c14282e
update
Apr 17, 2016
0d7426e
add callback to loadBio, update app.js
Apr 17, 2016
04717d3
rename files to provide better semantic meaning
patSSFC Apr 17, 2016
d235ec8
modify script tags in index to reflect name changes
patSSFC Apr 17, 2016
3c79cba
update bills with flex box'
tlwirtz Apr 17, 2016
bb6bb0d
fix merge conflicts
patSSFC Apr 17, 2016
ab41421
Merge branch 'i-9-Overview-View' into dev
patSSFC Apr 17, 2016
778a946
Update
Apr 17, 2016
aff88ec
rename more files
patSSFC Apr 17, 2016
b3cb7b1
add script sources for bioView bioController
patSSFC Apr 17, 2016
121c6e8
voting colors now update automatically
tlwirtz Apr 17, 2016
80e53be
update names
Apr 17, 2016
597edfe
initial search button work
muddybeard210 Apr 18, 2016
359859a
adjusted for merge conflicts
muddybeard210 Apr 18, 2016
9aa9ee2
update style for serach box
tlwirtz Apr 18, 2016
e921de9
styling of search section
tlwirtz Apr 18, 2016
e969078
add normalize css
tlwirtz Apr 18, 2016
dd2989f
add icon cdn and change search button
tlwirtz Apr 18, 2016
2d8e3fa
font to whilte for mor clarity
tlwirtz Apr 18, 2016
05ea55f
added jquery UI basic files and created js file to hold all searchabl…
muddybeard210 Apr 18, 2016
0e44f85
moved script tags around
muddybeard210 Apr 18, 2016
bf36c59
search functionality added. variable to store user input added
muddybeard210 Apr 18, 2016
ed3a7d2
added basic styling for autocomplete field. White background and bla…
muddybeard210 Apr 18, 2016
3e68f7f
input field color to white to match placeholder
tlwirtz Apr 19, 2016
1892418
refactor vote color function
tlwirtz Apr 19, 2016
63c57eb
remove test links
tlwirtz Apr 19, 2016
4a0a410
fix merge conflict
tlwirtz Apr 19, 2016
827dd31
Merge pull request #36 from patSSFC/i-29-basic-styling
tlwirtz Apr 19, 2016
5bdb8be
get contributor names in contributors array and start coding handelba…
patSSFC Apr 19, 2016
6de0ceb
Merge branch 'dev' of https://github.com/patSSFC/con-tracker into i-3…
patSSFC Apr 19, 2016
720fa51
tweaking css layout
muddybeard210 Apr 19, 2016
9bfc824
insert page js tag
tlwirtz Apr 19, 2016
fd101e1
pulled form dev and adjusted for merge conflicts
muddybeard210 Apr 19, 2016
55a24b5
fix bug with API call - added param to url
Apr 19, 2016
047bc2f
added env files and adjusted html conflicts
muddybeard210 Apr 19, 2016
e7eb5e3
main page.js is working, but routes are broken
tlwirtz Apr 19, 2016
c2087b6
fixed templating bug. Removed duplicate bioView file.
Apr 19, 2016
22a8cfe
added new searchView.js file to house possible search results from da…
muddybeard210 Apr 19, 2016
af2c386
Merge pull request #37 from patSSFC/i-9-Overview-View
patSSFC Apr 19, 2016
4c5d5a7
adjusted for merge conflicts
muddybeard210 Apr 19, 2016
efe1570
Merge branch 'dev' of https://github.com/patSSFC/con-tracker into i-3…
patSSFC Apr 19, 2016
807a488
working on building template
patSSFC Apr 19, 2016
2040700
static server must come at the end of our route checking
tlwirtz Apr 19, 2016
ae44081
get template working, had to move top contributors to its own template
patSSFC Apr 19, 2016
07272e6
had to move into public folder and reset root urls
tlwirtz Apr 19, 2016
4e4923b
Merge pull request #38 from patSSFC/i-32-top5
Apr 19, 2016
38b23a1
moved all files to public file in prep for merge from dev
muddybeard210 Apr 19, 2016
4b0ce9f
fix merge conflict... hopefully
tlwirtz Apr 19, 2016
af55fe3
Merge pull request #39 from patSSFC/i-35-pagejs
tlwirtz Apr 19, 2016
5b06c29
moved files to public folder
Apr 19, 2016
486c4b3
pulled from dev. adjusted for merge conflicts
muddybeard210 Apr 19, 2016
5579c3d
change file structure, move major dirs to public
patSSFC Apr 19, 2016
50c4d67
new files added
Apr 19, 2016
c79b50b
fix merge conflict
patSSFC Apr 19, 2016
ff7899a
added loop to grab first,last name from db
muddybeard210 Apr 19, 2016
3967283
Merge pull request #44 from patSSFC/i-3-searchBar
tlwirtz Apr 19, 2016
1f52245
cleaned up index
Apr 19, 2016
d9b978d
fixed routes for jquery
tlwirtz Apr 19, 2016
6e1fc98
remove extra space
tlwirtz Apr 20, 2016
77dc776
info from DB call is now compiled and used as a possible search option
muddybeard210 Apr 20, 2016
9948783
fix spacing issues
tlwirtz Apr 20, 2016
835ede5
add .eslintrc, fix linting errors
patSSFC Apr 20, 2016
593cd8a
fix lint errors in db/ and server.js
patSSFC Apr 20, 2016
0031645
fix merge conflict
patSSFC Apr 20, 2016
a107fc9
fix eslint errors, leaving the MFing double quotes...
patSSFC Apr 20, 2016
fd63960
udpate jquery and map searched name to id
tlwirtz Apr 20, 2016
91ae4f0
Merge branch 'dev' of https://github.com/patSSFC/con-tracker into dev
Apr 20, 2016
ce57534
Merge branch 'dev' of https://github.com/patSSFC/con-tracker into i-4…
Apr 20, 2016
3b9f885
remove unneceasry Contributor and Filing constrcutors, replace with e…
patSSFC Apr 20, 2016
519ebff
remove unused arrays
patSSFC Apr 20, 2016
f0d31fc
remove apikey from getFilings
patSSFC Apr 20, 2016
690516f
merge dev into this branch, fix conflicts
patSSFC Apr 20, 2016
b28ef06
remove comments and logs
patSSFC Apr 20, 2016
a684dff
update layout of bio section
Apr 20, 2016
06ce356
Merge pull request #47 from patSSFC/i-32-top5
Apr 20, 2016
f153ed1
remove about route and voteRepo.about
patSSFC Apr 20, 2016
4c283a9
added css functionality to the search feature
muddybeard210 Apr 20, 2016
eff1711
update bio layout. color title per party affiliation
Apr 20, 2016
6559de6
adjusted for merge conflicts
muddybeard210 Apr 20, 2016
a3d4341
Merge branch 'i-29-bio-styling' of https://github.com/patSSFC/con-tra…
Apr 20, 2016
59b42f5
update with fucking new legislator fields
tlwirtz Apr 20, 2016
69e5c9a
add functions to map first and last name to fec_id
tlwirtz Apr 20, 2016
85a43ad
Merge branch 'i-3-searchBar' of https://github.com/patSSFC/con-tracke…
tlwirtz Apr 20, 2016
650dce0
add financeViews object to hold view methods
patSSFC Apr 20, 2016
9e1bb3f
swap firstname and lastname cols
tlwirtz Apr 20, 2016
3353e7f
Merge branch 'dev' of https://github.com/patSSFC/con-tracker into dev
patSSFC Apr 20, 2016
8742b44
removed z-index from header tag to allow auto complete to show after …
muddybeard210 Apr 20, 2016
8726b97
populate image based on twitter profile picture
Apr 20, 2016
00894a1
added hover styling to seach results. comment out the console log fe…
muddybeard210 Apr 20, 2016
0f0803a
Merge branch 'i-3-searchBar' of https://github.com/patSSFC/con-tracke…
muddybeard210 Apr 20, 2016
5bca98c
call the politician/:id route
tlwirtz Apr 20, 2016
a7159e2
fix merge conflict
tlwirtz Apr 20, 2016
fad8384
combine top 10 and bio templates in index. need to confirm - opensecr…
Apr 20, 2016
9d97f40
get bioguide id from fec id so we can use with new york times
tlwirtz Apr 21, 2016
1fc0b1b
nyt api is now working with bioguide id
tlwirtz Apr 21, 2016
fbdc739
move fecid method down
tlwirtz Apr 21, 2016
3307fe6
return empty string if now bioguide id
tlwirtz Apr 21, 2016
0705362
added an "or" statment to var fecid
muddybeard210 Apr 21, 2016
ecc854d
adjusted for merge conflicts
muddybeard210 Apr 21, 2016
503e49a
move stuff to pulic, and fix a syntax error in financialView
patSSFC Apr 21, 2016
34801de
Merge branch 'dev' of https://github.com/patSSFC/con-tracker into i-2…
Apr 21, 2016
073baf0
combine bio and financial templates. Update function that colors poli…
Apr 21, 2016
901daea
get doughnut chart to show up
patSSFC Apr 21, 2016
ae149d0
offically working -- votes now pulled from nyt
tlwirtz Apr 21, 2016
3b41cdd
have to clear out repos.all before processing new serach
tlwirtz Apr 21, 2016
b930851
Merge pull request #50 from patSSFC/i-29-bio-styling
patSSFC Apr 21, 2016
2f4420a
chart is working, yaaay
patSSFC Apr 21, 2016
8900785
fix merge conflict
tlwirtz Apr 21, 2016
8a26851
Merge pull request #51 from patSSFC/i-3-searchBar
patSSFC Apr 21, 2016
25e6d7c
adjusted search css to run when route is called
muddybeard210 Apr 21, 2016
695e379
fix merge conflicts
patSSFC Apr 21, 2016
6a28f9c
adjusted for merge conflicts
muddybeard210 Apr 21, 2016
bedea94
Merge pull request #52 from patSSFC/i-48-financeWare
muddybeard210 Apr 21, 2016
0170150
udpate about route
tlwirtz Apr 22, 2016
d00c3ac
basic information in About section
tlwirtz Apr 22, 2016
de34c43
add data json skeleton
tlwirtz Apr 22, 2016
f14e996
moved data into json file
tlwirtz Apr 22, 2016
93a4299
about view created and udpate voting view
tlwirtz Apr 22, 2016
5f74e1b
changed default css so that when a new route is called, search will b…
muddybeard210 Apr 22, 2016
4c4a71a
Merge pull request #54 from patSSFC/i-3-searchBar
tlwirtz Apr 22, 2016
ec89feb
trying to get about view to work
tlwirtz Apr 22, 2016
1e8495a
fix merge conflict
tlwirtz Apr 22, 2016
4235ebb
hide about page when we are not on it
tlwirtz Apr 22, 2016
eace505
chart works. template not displaying
patSSFC Apr 22, 2016
78597df
fix merge conflict
tlwirtz Apr 22, 2016
a1f3032
fixed template. it works
patSSFC Apr 22, 2016
b260853
Merge branch 'test-branch' of https://github.com/patSSFC/con-tracker …
tlwirtz Apr 22, 2016
c3f71d8
Merge pull request #55 from patSSFC/test-branch
tlwirtz Apr 22, 2016
cc176fc
fix merge conflict
tlwirtz Apr 22, 2016
e721eb4
fix errors on about template
tlwirtz Apr 22, 2016
9bfd2f6
remove spaces from json to render properly
tlwirtz Apr 22, 2016
28e0241
adding about link on top of page
muddybeard210 Apr 22, 2016
43d7200
Merge branch 'i-53-about-page' of https://github.com/patSSFC/con-trac…
muddybeard210 Apr 22, 2016
c12d678
rewrite routes and fix conflict in votingController....dejavu?
patSSFC Apr 22, 2016
ca1e152
Merge pull request #56 from patSSFC/test-branch
tlwirtz Apr 22, 2016
7f36161
fix typo in routes.js
patSSFC Apr 22, 2016
21ab2bb
Merge pull request #57 from patSSFC/test-branch
patSSFC Apr 22, 2016
5d795f1
Merge pull request #58 from patSSFC/dev
patSSFC Apr 22, 2016
30a0708
fix conflict
patSSFC Apr 22, 2016
68686fc
change ionicons cdn to https://
patSSFC Apr 22, 2016
2dea572
Merge branch 'dev' into master. fixed a typo error.
patSSFC Apr 22, 2016
fd6e3e0
add middleware for bio info
Apr 23, 2016
f1e275b
removed redundant functions, cleaned up code for readability.
Apr 23, 2016
6ce052b
comment out finance templating/appending. this way, template is only …
Apr 23, 2016
17d0371
Merge pull request #59 from patSSFC/i-14-Overview-API-Call
patSSFC Apr 24, 2016
0569bc0
further styling to set "about" page
muddybeard210 Apr 24, 2016
7776341
Merge branch 'dev' of https://github.com/patSSFC/con-tracker into i-5…
muddybeard210 Apr 24, 2016
6b35c21
remove obsolete code from financeView, modify color of canvas
patSSFC Apr 24, 2016
a0fe4c6
lowered canvas element so it is below the search bar now
muddybeard210 Apr 24, 2016
db5b813
create new chart overtime, remove more comments/logs
patSSFC Apr 24, 2016
19b5710
remove obsolete script files
patSSFC Apr 24, 2016
ba999a9
remove images/ dir
patSSFC Apr 24, 2016
c0226c0
remove comments from all script files and rm obsolete financialCharts
patSSFC Apr 24, 2016
3ab64dc
Merge pull request #60 from patSSFC/touchUp
tlwirtz Apr 24, 2016
e0fc666
update chart styling and add padding to make alignment better
tlwirtz Apr 24, 2016
34bee3d
fix merge conflict
patSSFC Apr 24, 2016
c70cc85
Merge branch 'i-fix-chart-placement' into dev
patSSFC Apr 24, 2016
3707521
Merge branch 'dev'
patSSFC Apr 24, 2016
8c33bb2
styled about button and header to be centered
muddybeard210 Apr 24, 2016
11375e3
removed commented out code
muddybeard210 Apr 24, 2016
77c1bc7
Merge pull request #62 from patSSFC/i-53-about-page
patSSFC Apr 24, 2016
467fe1e
fixed some layout issues. Pushed bio down and removed canvas margin
muddybeard210 Apr 24, 2016
b4e04fc
Merge pull request #63 from patSSFC/i-53-about-page
patSSFC Apr 24, 2016
875cfe9
handle potential null errors
Apr 24, 2016
30cd6b4
update buildImage variable
Apr 24, 2016
e036730
Merge pull request #64 from patSSFC/i-14-Overview-API-Call
patSSFC Apr 24, 2016
122a5a4
need to use crp id instead of fec ide for candidate
tlwirtz Apr 24, 2016
34c6f37
add viewport height to get purple to extend down all the way
tlwirtz Apr 24, 2016
86c4818
changed background size to 100vh instead of hard coding px
muddybeard210 Apr 24, 2016
0817cbb
Merge branch 'dev' of https://github.com/patSSFC/con-tracker into i-5…
muddybeard210 Apr 24, 2016
73115b0
added hide/show to sections when on the about page. Adjusted for pho…
muddybeard210 Apr 24, 2016
0c42d57
Merge pull request #65 from patSSFC/i-53-about-page
patSSFC Apr 24, 2016
90ffe18
Merge pull request #66 from patSSFC/dev
patSSFC Apr 24, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"settings": {
"ecmascript": 5
},
"ecmaFeatures": {
},
"env": {
"browser": true,
"jquery": true
},
"rules": {
"semi": 1,
"strict": 0,
"indent": [2, 2],
"quotes": [1, "single"],
"no-multi-spaces": [1, {
"exceptions": {
"VariableDeclarator": true,
"FunctionExpression": true
}
}],
"key-spacing": [0, {"align": "value"}],
"no-underscore-dangle": 0
}
}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
.DS_Store
test-data/
../scripts/testRequest.js

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a couple files here that aren't necessary at this point?

../scripts/financialCharts.js
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node server.js
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# CONTRACKER
Copy link

@sjschmidt44 sjschmidt44 May 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic README! Great job explaining the tools and services that you used to build the project, and how to use your APIs!


## Interacting with cache database
The cache database holds bulk data regarding politicians. This includes common bio information as well as ids for common databases.

The database can be queried at the ```/database/``` route. By default all columns and records will be returned.
An ```array``` of rows can be accessed at the ```req.data.rows``` property.

Future support is planned for filtering columns and rows.

Everyone will need to set their ```env.process.DATABASE_URL``` to the heroku config var.

## Interacting with APIs
Proxies have been set up for the major APIs used by the Sunlight Foundation and Open Secets.
### OpenSecrets APIs
The OpenSecret API is accessed via `GET` requests to the `/opensecrets/` route.
Query parameters should be sent to this route per the OpenSecrets API documentation.

**DO NOT** include the `apikey` parameter. The proxy will add this for you.

**EXAMPLE**:

`http://www.opensecrets.org/api/?method=getLegislators&output=json` becomes
`/opensecrets/?method=getLegislators&output=json`

## Sunlight Foundation API
The Sunlight Foundation API is accessed via `GET` requests to one of the following routes:

`/sunlight_congress/` for the Congress API

`/sunlight_states/` for the States API

`/sunlight_finance/` for the Realtime Finance API

## New York Times API
The New York Times API can be found at `/nyt_api/`.

Use the proxy like this: ```/nyt_api/[[member]]/votes.json```
49 changes: 49 additions & 0 deletions api-proxy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
var requestProxy = require('express-request-proxy');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great use of proxying your services, and routing your app functionality.


var apiProxy = function () {
var proxySunlightCongress = function (req, res) {
console.log('Routing for sunglight api', req.params[0]);
(requestProxy({
url: 'https://congress.api.sunlightfoundation.com/' + req.params[0],
headers: { 'X-APIKEY': process.env.SUNLIGHT_API_KEY },
}))(req, res);
};

var proxySunlightStates = function (req, res) {
req.query.apikey = process.env.SUNLIGHT_API_KEY;
(requestProxy({
url: 'http://openstates.org/api/v1/' + req.params[0],
}))(req, res);
};

var proxySunlightFinance = function (req, res) {
req.query.apikey = process.env.SUNLIGHT_API_KEY;
(requestProxy({
url: 'http://realtime.influenceexplorer.com/api//' + req.params[0],
}))(req, res);
};

var proxyOpenSecrets = function (req, res) {
req.query.apikey = process.env.OPENSECRETS_API_KEY;
(requestProxy({
url: 'http://www.opensecrets.org/api/',
}))(req, res);
};

var proxyNewYorkTimes = function (req, res) {
req.query['api-key'] = process.env.NYT_API_KEY;
(requestProxy({
url: 'http://api.nytimes.com/svc/politics/v3/us/legislative/congress/members/' + req.params[0],
}))(req, res);
};

return {
proxySunlightFinance: proxySunlightFinance,
proxySunlightStates: proxySunlightStates,
proxySunlightCongress: proxySunlightCongress,
proxyOpenSecrets: proxyOpenSecrets,
proxyNewYorkTimes: proxyNewYorkTimes,
};
};

module.exports = apiProxy();
Loading