Last active
July 20, 2019 01:45
-
-
Save grant/83abfda1d69131c513757716c74aa251 to your computer and use it in GitHub Desktop.
GCF Debugging VSC List Google APIs
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 {google} = require('googleapis'); | |
/** | |
* Returns a list of Google APIs and their descriptions. | |
* @param {Express.Request} req The API request. | |
* @param {Express.Response} res The API response. | |
*/ | |
exports.listGoogleAPIs = async (req, res) => { | |
// Call the API | |
const apis = await google.discovery('v1').apis.list(); | |
// Build the response | |
const jsonResponse = {}; | |
apis.data.items.map((api) => { | |
jsonResponse[api.id] = api.description; | |
}); | |
// Sent the response | |
res.send(jsonResponse); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment