[go: up one dir, main page]

Skip to content

jalandis/congress-go-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Wrapper for ProPublica Congress API CircleCI

Backend API that wraps the ProPublic Congress API.

  • Handles API Key securely
  • Caches API requests for 24 hours
  • Converts ProPublica API responses to jsonapi format
  • Serves Ember site

Development Environment Setup

Dependencies:

  • Go 1.10.4
  • dep v0.5.0

A ProPublica API key will be required. After registering with the Propublica Data Store, an email with the key will be sent.

The application has its settings passed in through a JSON configuration file. Below is an example of the required format. Please alter paths, ports and API key to fit your environment. See the Ember Frontend section for more information on the EmberPath variable.

{
    "Port": 8080,
    "EmberPath": "***/congress-ember/dist",
    "ApiBase": "https://api.propublica.org/congress/v1",
    "ApiKey": "***",
    "CacheTimeOut": "24h"
}

Install Dependencies:

go get ./..

Alternative Installation of Dependencies (still in testing):

dep ensure

Run Server:

go run github.com/jalandis/congress-go-api/main.go --config_path ./config.json

After starting the server, the following url can be used to load an example JSON response to confirm proper setup.

http://localhost:8080/api/v1/legislation

Ember FrontEnd

This API project serves a Congress Ember application and will require the Ember app be built locally for testing, development, or demo.

Please follow the installation and build sections of the Ember README and update the EmberPath value in this projects json configuration to point to the Ember dist folder.

Helpful Go Commands

Format all code and run unit tests:

gofmt -s -w .
go test -race ./...

Evaluate test coverage:

go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out

View documentation:

godoc -http=:6060

Helpful CircleCi Commands

circleci local execute --job build

About

Wrapper for ProPublica Congress API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages