Giter Site home page Giter Site logo

legislators-api-phoenix's Introduction

legislators-api-phoenix

This is a Phoenix (Elixir) implementation of an example backend for redux-remote-datatable.

Setup

Ensure docker-compose is installed and docker daemon is running. Navigate to the project folder and run docker-compose up. The API should be available at localhost:4000/api.

  1. Navigate to the project root and run git clone [email protected]:unitedstates/congress-legislators.git.
  2. Exec into the Phoenix container with docker-compose exec app bash.
  3. Seed the database with mix run priv/repo/seeds.exs.

Then, use the redux-remote-datatable as so:

<DataTableRedux fields={{"Name": "official_name", "Birthday": "birthday", "Thomas ID": "thomas_id" }} ajax={"http://localhost:4000/api/legislators"} idField={"id"} />

Endpoints

There is currently only one endpoint.

  • POST /api/legislators

Example Request

{
  "draw": 1,
  "page": 1,
  "perPage": 10,
  "sortField": null,
  "sortDirection": "asc",
  "searchValue": ""
}

Example Response

{
    "draw": "1",
    "totalRecords": 473,
    "data": [
        {
            "id": 52,
            "official_name": "Roy Blunt",
            "thomas_id": "01464",
            "birthday": "1950-01-10"
        },
        {
            "id": 51,
            "official_name": "Richard Blumenthal",
            "thomas_id": "02076",
            "birthday": "1946-02-13"
        },
        ...
    ]
}

legislators-api-phoenix's People

Contributors

ken-nurelm avatar kenforthewin avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.