Created
July 8, 2018 22:12
-
-
Save jason-dark/84f7d09a9fc30207b96cafcbdfe6db76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sfAuth = require('../fetch-data/sf-auth'); | |
const sfQuery = require('../fetch-data/sf-query'); | |
const sendRes = require('../fetch-data/send-res'); | |
exports.handler = function (req, res) { | |
if (req.method !== "GET") { | |
console.log("✘ Request was not GET"); | |
sendRes(res, 405, "Not Allowed"); | |
} | |
else { | |
sfAuth() | |
.then(conn => { | |
sfQuery(conn) | |
.then(data => { sendRes, 200, data }) | |
.catch(e => { sendRes(res, 500, "Server Error") }) | |
}) | |
.catch(e => { sendRes(res, 500, "Server Error") }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment