Giter Club home page Giter Club logo

survey's Introduction

Survey widget

##Introduction

This widget can be applied to your webpage to prompt your users with unique survey questions whenever they visit. An admin panel is provided to allow you to view, create, and archive your survey questions.

The app is separated into two parts: a server directory for serving and storing survey questions, and a static client folder that can be served from gh-pages or a CDN.

Installation

Currently this is a work in progress.

Demo

Here's a running demo.

If you want to do it yourself:

###Copy the project files

First, fork this repo and clone it to your local machine by typing git clone https://github.com/<YOUR-GITHUB-HANDLE>/survey.git. This will clone the project files for your use.

Alternatively, you can just download the project files and copy it somewhere on your machine.

###Server

Make sure your server machine is running mysql and has node.js installed before continuing. (You might run into an issue while installing bcrypt. Create a symlink by executing sudo ln -s /usr/bin/nodejs /usr/bin/node after installing node.)

Copy the contents of server to wherever you'll be serving this from.

Check your configuration files in config/config.json:

app.json

{
  "port": 55555,
  "cors": {
    "AllowOrigin": [
      "http://survey.app"
    ]
  }
}

Set the listening port for the node server and specify any permitted request origins for CORS, if necessary.

auth.json

{
  "token": {
    "secret": "aRandomString",
    "options": {
      "expiresIn": "1d"
    }
  }
}

Set a secret string from which to generate authentication tokens, and set the expiry time. For more information on options, see https://github.com/auth0/node-jsonwebtoken

database.json

{
  "database": "survey",
  "username": "homestead",
  "password": "secret",
  "host": "localhost",
  "port": "33060"
}

Set the database information for your instance of mysql. You will need to create a mysql database on the server.

Server Set-up

Once your configuration files are in place, run from within the folder

npm install
./node_modules/.bin/sequelize db:migrate
./node_modules/.bin/sequelize db:seed:all

This will set up your database schema, create an admin user with the credentials admin//kevinisawesome, and populate a sample survey question for you.

To start the server, run

node server.js

###Client

In the app folder, create a config/config.json file that contains the server url (don't include the protocol) and port (should be the same as the specified port for the server, above).

Example:

{
  "server": {
    "url": "127.0.0.1",
    "port": 55555,
    "api": "api"
  }
}

Then, run

npm install
gulp --production

And copy the contents of public to wherever you'll be serving the pages from.

Usage

In the demo, you'll see a small blue tab on the left hand side of your screen. This is the button to access the Admin dashboard to manage the survey questions.

I used evercookie to recognize unique visitors to the site. Visitors will automatically be prompted to answer a unique survey question once they visit the site.

survey's People

Contributors

leekevin avatar

Watchers

James Cloos 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.