graphql-engine/community/sample-apps/realtime-poll
Areski Belaid a4a7b760db
refresh the sample app realtime-poll (#4337)
* [fix](realtime-poll) refresh project realtime-poll

* remove comment lines

Co-authored-by: Praveen Durairaju <praveend.web@gmail.com>
Co-authored-by: Praveen Durairaju <praveen@hasura.io>
Co-authored-by: Tirumarai Selvan <tiru@hasura.io>
2020-04-21 12:24:51 +05:30
..
hasura refactor community content and folder structure (#1353) 2019-01-17 15:57:28 +05:30
public refresh the sample app realtime-poll (#4337) 2020-04-21 12:24:51 +05:30
src refresh the sample app realtime-poll (#4337) 2020-04-21 12:24:51 +05:30
.dockerignore refactor community content and folder structure (#1353) 2019-01-17 15:57:28 +05:30
.gitignore refactor community content and folder structure (#1353) 2019-01-17 15:57:28 +05:30
Dockerfile refactor community content and folder structure (#1353) 2019-01-17 15:57:28 +05:30
package.json refresh the sample app realtime-poll (#4337) 2020-04-21 12:24:51 +05:30
README.md noop: replace subdomain links with subpath (#3869) 2020-02-27 15:43:07 +05:30
yarn.lock refresh the sample app realtime-poll (#4337) 2020-04-21 12:24:51 +05:30

hasura-realtime-poll

A demo application to showcase real-time capabilities of Hasura GraphQL Engine.

Edit realtime-poll

The Realtime Poll application is built using React and is powered by Hasura GraphQL Engine over Postgres. It has an interface for users to cast vote on a poll and the results are updated in the on-screen bar chart, in real-time.

The application makes use of Hasura GraphQL Engine's real-time capabilities using subscription. There is no backend code involved. The application is hosted on GitHub pages and the Postgres+GraphQL Engine is running on Postgres.

Running the app yourself

  • Deploy Postgres and GraphQL Engine on Heroku:

    Deploy to
heroku

  • Get the Heroku app URL (say random-string-123.herokuapp.com)

  • Clone this repo:

    git clone https://github.com/hasura/graphql-engine
    cd graphql-engine/community/sample-apps/realtime-poll
    
  • Install Hasura CLI

  • Goto hasura/ and edit config.yaml:

    endpoint: https://random-string-123.herokuapp.com
    
  • Apply the migrations:

    hasura migrate apply
    
  • Edit HASURA_GRAPHQL_ENGINE_HOSTNAME in src/apollo.js and set it to the Heroku app URL:

    export const HASURA_GRAPHQL_ENGINE_HOSTNAME = 'random-string-123.herokuapp.com';
    
  • Run the app (go the root of repo):

    npm install
    npm start