Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
app.get("/api/discover", async (req, res) => {
const onlySpecificEndpoints = Array.isArray(req.query.include);
const excludeEndpoints = Array.isArray(req.query.exclude);
const usages = req.query.usages;
const endpoints = [];
for (let i in webiny.endpoints) {
const endpoint = webiny.endpoints[i];
if (onlySpecificEndpoints) {
if (!req.query.include.includes(endpoint.classId)) {
continue;
}
}
const current = { classId: endpoint.classId, url: i, methods: [] };
const instance = new endpoint.versions[endpoint.latest]();
const apiMethods = instance.getApi().getMethods();
Object.keys(apiMethods).forEach(name => {
current["methods"].push(apiMethods[name].toJSON());
});
if (excludeEndpoints) {
if (req.query.exclude.includes(current.classId)) {
continue;
}
app.get("/api/discover", async (req, res) => {
const onlySpecificEndpoints = Array.isArray(req.query.include);
const excludeEndpoints = Array.isArray(req.query.exclude);
const usages = req.query.usages;
const endpoints = [];
for (let i in webiny.endpoints) {
const endpoint = webiny.endpoints[i];
if (onlySpecificEndpoints) {
if (!req.query.include.includes(endpoint.classId)) {
continue;
}
}
const current = { classId: endpoint.classId, url: i, methods: [] };
const instance = new endpoint.versions[endpoint.latest]();
const apiMethods = instance.getApi().getMethods();
Object.keys(apiMethods).forEach(name => {
current["methods"].push(apiMethods[name].toJSON());
});
if (excludeEndpoints) {
if (req.query.exclude.includes(current.classId)) {
continue;