From c8a0fcc7f148616287d19f9ef21e7d8f7db88dbf Mon Sep 17 00:00:00 2001 From: tareq89 Date: Tue, 1 Nov 2016 19:15:56 +0600 Subject: [PATCH] product search: adding a custom temporary api end point subscribe for gofetch landing page, will be removed after GO! Fetch b2c is online --- server.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/server.js b/server.js index 4996676..309aa5a 100644 --- a/server.js +++ b/server.js @@ -169,6 +169,20 @@ router.get('/store', function (req, res) { }) }) + + +router.post('/subscribe', function (req, res) { + console.log(req.body); + var email = req.body; + MongoClient.connect(productDbUrl, function (err, db) { + assert.equal(null, err); + db.collection('subscribed').insert(email, function (err, result) { + assert.equal(null, err); + db.close(); + res.json({ msg: "successfull" }); + }); + }) +}) app.use('/api', router); app.listen(port);