Git Product home page Git Product logo

poll's Introduction

Nick's Poll App (tentative title) is a polling addon for HipChat.

Features

  • OAuth integration
  • Instant updates on results screen
  • Single or Multiple choice polls
  • Allow users to vote only once

Local Development Tutorial

Here's how to set up this addon for local development with HipChat:

Install Node

This app was developed under NodeJS v6.x. Because the Node version in most apt-get repositories is woefully out of date, because reasons, we need to add a new source to install the latest version.

$ sudo apt-get install curl build-essential
$ curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh
$ sudo bash nodesource_setup.sh
$ sudo apt-get install nodejs

Install Postgres

Postgres will be our database. After installing, it creates a user account called postgres, which we'll switch into to run commands on the database.

$ sudo apt-get install postgresql postgresql-contrib
$ sudo -u postgres psql

That will load the CLI for Postgres. At the prompt, run the following two commands, replacing the username, password, and database name with whatever you'd like:

CREATE USER poll WITH SUPERUSER PASSWORD 'P@$$w0rd!';
CREATE DATABASE poll;

Install App Code

After cloning this git repository locally, we'll need to install packages and edit some config files.

$ npm install
$ mv config/default.json.sample config/default.json

Edit default.json and insert the database name, username, and password you entered before.

Run Database Migrations

Sequelize is the NPM package used to communicate with the SQL database. To set up the initial state of the database, we'll need to run migrations, which are defined in the /migrations directory. They are run in order on our database after running the migrate command.

$ sudo npm install -g sequelize-cli
$ sequelize init:config

Edit the generated config/config.json file with your database login settings above (you only really need to do the development database). Then run:

$ sequelize db:migrate

Run Application

HipChat addons are required to be HTTPS-enabled, making local development a bit difficult. ngrok to the rescue! ngrok is used to tunnel local traffic to an external HTTPS server. Download and install ngrok, and then, in a different console window, run:

$ ./ngrok http 4001

Copy the https hostname given in ngrok into the config/default.json file. We're finally ready to go! Start up the node process with:

$ node bin/www

The https://xxxxxxxx.ngrok.io/capabilities URL should load a JSON document if all went well.

poll's People

Contributors

snickroger avatar

Watchers

 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.