-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.js
38 lines (29 loc) · 842 Bytes
/
routes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
var config = require('./config');
var express = require('express');
var path = require('path');
var db = require('./database');
var twilio = require('twilio');
module.exports = function (app) {
app.get('/', function(req, res) {
res.render('index.html', {
name: 'Andy'
});
});
app.post('/', function(req, res) {
var response = new twilio.TwimlResponse();
response.sms('Hello from Twilio');
console.log(req.body.Body);
var teamName = req.body.Body || null;
var vote = {}
var from = req.body.From || null;
vote[from] = teamName;
db.update(vote);
//res.send(response.toString());
});
app.get('/ryan', function(req, res) {
res.render('index.html', {
name: 'Ryan'
});
});
app.use("/public", express.static(path.join(__dirname, 'public')));
};