-
Notifications
You must be signed in to change notification settings - Fork 3
Home
Isaac Dontje Lindell edited this page Oct 25, 2013
·
16 revisions
Welcome to the TapVote wiki!
Here is our proposal: TapVote proposal
/createSurvey:
surveyData = { 'title':'"Because clickers are SO 1999."',
'questions': [{'question': 'Which is best?',
'answers': ["Puppies", "Cheese", "Joss Whedon", "Naps"]
}],
'password':'supersecretpassword'
}
/getSurveyInfo:
var ret = { title: "A sweet survey",
questions: [
{ id:12,
value:"What is your favorite color",
answers: [
{id:45, value:"blue"},
{id:32, value:"red"}
]
},
{ id:14,
value:"What is your favorite food",
answers: [
{id:21, value:"pizza"},
{id:18, value:"cake"},
{id:12, value:"brains"}
]
}
]
};
To set up a test database on Ubuntu (maybe all *nix?):
$ sudo apt-get install postgresql-
$ sudo -u postgres psql postgres. Connects to the newly installed Postgres server using the defaultpostgresdatabase -
# \password postgres. Will prompt you for a password. Probably should usewearetapvotefor now. # create database tapvotetest;-
CTRL-Dto exit psql. -
$ sudo -u postgres psql tapvotetest. Connect to the newly createdtapvotetestdatabase. - Create the schema:
CREATE TABLE survey (
id serial PRIMARY KEY,
title text,
password text
);
CREATE TABLE question (
id serial PRIMARY KEY,
"surveyId" integer REFERENCES survey(id),
value text
);
CREATE TABLE answer (
id serial PRIMARY KEY,
"questionId" integer REFERENCES question(id) ,
value text
);
CREATE TABLE vote (
id serial,
"questionId" integer REFERENCES question(id),
"answerId" integer REFERENCES answer(id)
);
The connection string used to connect to the database using Node.js is:
var CONNSTRING = "postgres://postgres:wearetapvote@localhost/tapvotetest";