-
Notifications
You must be signed in to change notification settings - Fork 0
DO NOT MERGE --- SUBMISSION PULL REQUEST #67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: start
Are you sure you want to change the base?
Changes from all commits
418a4ec
1309e7f
33b6fe9
4d6449c
30170c6
d005b0b
9f260a1
afe1970
cc0913c
f127404
e26a27c
86aa972
5a1416f
765b3da
805836d
2a76e6b
6845429
57ad427
bda9e25
3a9b569
95c641e
a4d0480
fad725c
32bdf23
08436e9
0ce466e
75c3fad
2d2d718
d3221ec
0269552
cdc6564
66e2dc8
1377400
2bae703
707df2d
ea810ad
9627364
d752f60
892db03
efa67af
b6e108d
50cc663
fa6b5da
683365b
5b73c8f
d9b8207
3fbd391
6bd9394
6d6c026
be2a886
f977e61
0176f33
1bd0f3d
6ec8112
d04dfd5
9d768f1
be67e45
0bb156d
6848252
a4e0363
d662c16
b6ceee4
895e1d0
ba78916
bc923c1
d99e6b1
5f51620
d1cd088
5cd4392
dea3a62
70c85f6
75ad29b
623f59c
4059597
f6cc8fb
13c9bdc
63aa38f
c14282e
0d7426e
04717d3
d235ec8
3c79cba
bb6bb0d
ab41421
778a946
aff88ec
b3cb7b1
121c6e8
80e53be
597edfe
359859a
9aa9ee2
e921de9
e969078
dd2989f
2d8e3fa
05ea55f
0e44f85
bf36c59
ed3a7d2
3e68f7f
1892418
63c57eb
4a0a410
827dd31
5bdb8be
6de0ceb
720fa51
9bfc824
fd101e1
55a24b5
047bc2f
e7eb5e3
c2087b6
22a8cfe
af2c386
4c5d5a7
efe1570
807a488
2040700
ae44081
07272e6
4e4923b
38b23a1
4b0ce9f
af55fe3
5b06c29
486c4b3
5579c3d
50c4d67
c79b50b
ff7899a
3967283
1f52245
d9b978d
6e1fc98
77dc776
9948783
835ede5
593cd8a
0031645
a107fc9
fd63960
91ae4f0
ce57534
3b9f885
519ebff
f0d31fc
690516f
b28ef06
a684dff
06ce356
f153ed1
4c283a9
eff1711
6559de6
a3d4341
59b42f5
69e5c9a
85a43ad
650dce0
9e1bb3f
3353e7f
8742b44
8726b97
00894a1
0f0803a
5bca98c
a7159e2
fad8384
9d97f40
1fc0b1b
fbdc739
3307fe6
0705362
ecc854d
503e49a
34801de
073baf0
901daea
ae149d0
3b41cdd
b930851
2f4420a
8900785
8a26851
25e6d7c
695e379
6a28f9c
bedea94
0170150
d00c3ac
de34c43
f14e996
93a4299
5f74e1b
4c4a71a
ec89feb
1e8495a
4235ebb
eace505
78597df
a1f3032
b260853
c3f71d8
cc176fc
e721eb4
9bfd2f6
28e0241
43d7200
c12d678
ca1e152
7f36161
21ab2bb
5d795f1
30a0708
68686fc
2dea572
fd6e3e0
f1e275b
6ce052b
17d0371
0569bc0
7776341
6b35c21
a0fe4c6
db5b813
19b5710
ba999a9
c0226c0
3ab64dc
e0fc666
34bee3d
c70cc85
3707521
8c33bb2
11375e3
77c1bc7
467fe1e
b4e04fc
875cfe9
30cd6b4
e036730
122a5a4
34c6f37
86c4818
0817cbb
73115b0
0c42d57
90ffe18
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| node_modules | ||
| .DS_Store | ||
| test-data/ | ||
| ../scripts/testRequest.js | ||
| ../scripts/financialCharts.js | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| web: node server.js |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # CONTRACKER | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| var requestProxy = require('express-request-proxy'); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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(); | ||
There was a problem hiding this comment.
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?