Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made SMTP settings generic, updated README

  • Loading branch information...
commit 1cea0828823c38cde1bf77c50244b4d56032c9a8 1 parent 195098d
@wylieconlon authored
Showing with 33 additions and 9 deletions.
  1. +29 −4 README.md
  2. +4 −5 app.js
View
33 README.md
@@ -8,7 +8,7 @@ lecture is going too fast or too slow.
VoteSpry is a super-simple app that lets anybody vote on a poll via text
message. It's focused primarily on real-time situations with an audience to
-gather feedback from.
+gather feedback from. It takes 30 seconds to create a poll.
How it works
------------
@@ -45,9 +45,17 @@ and urls. Here is a sample settings.js file:
settings.dbHost = 'mongodb://localhost';
settings.dbName = 'votespry';
- settings.twilio = {};
+ var email = {};
+ settings.email = email;
- var tw = settings.twilio;
+ email.host = 'smtp.sendgrid.net';
+ email.from = '### YOUR SENDGRID EMAIL';
+
+ email.user = '### YOUR SENDGRID USER';
+ email.password = '### YOUR SENDGRID PASSWORD:';
+
+ var tw = {};
+ settings.twilio = tw;
tw.sid = '### YOUR TWILIO SID';
tw.auth = '### YOUR TWILIO AUTH TOKEN';
@@ -67,7 +75,11 @@ and urls. Here is a sample settings.js file:
tw.root = tw.protocol + tw.sid + ':' + tw.auth + '@' + tw.host + tw.path;
module.exports = settings;
-
+
+### Note about sending email
+
+You can use any SMTP server for this, such as [Sendgrid](http://sengrid.com).
+
### Note about Twilio
This project is tricky to test locally because Twilio must have a web-accessible
@@ -75,3 +87,16 @@ URL for its incoming SMS callbacks. That's why there's an alternate way to vote
by sending an HTTP `GET` to the `/vote/:code/:choiceIndex` route (note: only one
vote per user is enforced). One possibility is to use a proxy service to forward
requests at a remote service to your machine.
+
+
+Running the app
+---------------
+
+VoteSpry runs on port 80, which requires root privileges to bind to. To run it
+locally, you can use the [node-dev](https://github.com/fgnass/node-dev) server:
+
+ sudo node-dev app.js
+
+On a production server, you must specify the NODE\_ENV environment variable:
+
+ sudo NODE_ENV=production /usr/local/bin/node app.js
View
9 app.js
@@ -42,7 +42,6 @@ app.configure(function() {
app.use(express.cookieParser());
app.use(express.session({ secret: "vote spry" }));
app.use(expressValidator);
- //app.use(mongooseAuth.middleware());
app.use(app.router);
});
@@ -129,9 +128,9 @@ app.post('/new', function(req, res) {
console.log(doc);
email.send({
- host: settings.sendgrid.host,
+ host: settings.email.host,
- from: settings.sendgrid.from,
+ from: settings.email.from,
to: req.body.email,
subject: "Administration link for your VoteSpry poll",
@@ -143,8 +142,8 @@ app.post('/new', function(req, res) {
},
authentication: 'login',
- username: settings.sendgrid.user,
- password: settings.sendgrid.password
+ username: settings.email.user,
+ password: settings.email.password
},
function(err) {
console.log(err);
Please sign in to comment.
Something went wrong with that request. Please try again.