Code Monkey home page Code Monkey logo

thumbs-up's Introduction

A minimal voting system through github identities

Background

This project was created as a help to help ensure the quality of internal documentation at SEB. It is integrated as an iframe where every documentation path serves as a page id. It shows all users the votes currently in place for that page id, but to be able to vote, the user needs to login in through github's oauth flow. It uses bitnamis version of postgres and is thus able to run in OpenShift environments without the need to run as root.

Getting started

PLEASE NOTE: This repo uses Font Awesome Pro icons

Since these are not freely distributed, you need to to either change the HTML to include a different icon, or acquire a Font Awesome license key. To build with your key, create a .npmrc file to the root of the project and include the auth token there.

Installation

  1. npm i
  2. npm start / npm e2e-test

or use docker compose

  1. docker-compose up
  2. step inside the container
  3. run npm start / npm e2e-test

Mocking github

When running the tests it is sometimes practical to mock the github endpoint. This is done with the nock npm package and is enabled with the mockGithub in settings.js

Integration with your webpage

  1. Create an Oauth app.

  2. Set the app Authorization callback URL to http://localhost:5000/authorized to run locally or where ever you are deploying + /authorized

  3. Deploy the application (or fill in the docker-compose) somewhere with the following environment variables, they will be given to the application through settings.js:

    • githubUrl - either https://github.com or optionally an enterprise github installation e.g https://github.yourcompany.se
    • client_id - fetch this from your newly created Oauth app
    • client_secret - fetch this from your newly created Oauth app
    • state_password - a randomly generated string, preferably 32 characters
  4. To make sure everything works accordingly, visit http://localhost:5000/?page_id=exampleid&redirect_uri=http://localhost:5000, if you are running locally. This should give you a working frame for voting for page id "exampleid". If you are able to login and place votes, everything is ready to be integrated in an iframe.

  5. Create an iframe inside your application where the votes should take place with the necessary params (pageId, ), e.g:

    <iframe id="thumbs-up-frame" src="<URL of the deployed THUMBS_UP service>?redirect_uri=<URL to be redirected to after authed>&page_id=<ID of the page to be voted upon>></iframe>

thumbs-up's People

Contributors

stuart-webster-seb avatar

Stargazers

 avatar

Watchers

 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.