Skip to content

Commit 16df130

Browse files
author
joeltaylor
committed
Parse JSON for subscribe POST
1 parent 094353f commit 16df130

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

routes/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ var bodyParser = require('body-parser');
55
var mcapi = require('mailchimp-api');
66

77
mc = new mcapi.Mailchimp(process.env.MAILCHIMP_API);
8-
var parseForm = bodyParser.urlencoded({ extended: false });
8+
var parseJson = bodyParser.json();
99

1010
/* GET home page. */
1111
router.get('/', function(req, res, next) {
1212
res.render('index');
1313
});
1414

1515
/* POST subscribe an email to JS5 list. */
16-
router.post('/subscribe', parseForm, function(req, res) {
16+
router.post('/subscribe', parseJson, function(req, res) {
1717
mc.lists.subscribe(
1818
{
1919
id: process.env.LIST_ID,

0 commit comments

Comments
 (0)