Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// @flow
import { createHandler, PluginsContainer } from "@webiny/api";
import createConfig from "service-config";
import servicePlugins from "@webiny/api/plugins/service";
import securityPlugins from "@webiny/api-security/plugins";
const plugins = new PluginsContainer([servicePlugins, securityPlugins]);
let apolloHandler;
export const handler = async (event: Object, context: Object) => {
if (!apolloHandler) {
const config = await createConfig();
const { handler } = await createHandler({ plugins, config });
apolloHandler = handler;
}
return apolloHandler(event, context);
};
// @flow
import { createHandler, PluginsContainer } from "@webiny/api";
import createConfig from "service-config";
import servicePlugins from "@webiny/api/plugins/service";
import securityPlugins from "@webiny/api-security/plugins/service";
import filesPlugins from "@webiny/api-files/plugins";
const plugins = new PluginsContainer([servicePlugins, securityPlugins, filesPlugins]);
let apolloHandler;
export const handler = async (event: Object, context: Object) => {
if (!apolloHandler) {
const config = await createConfig();
const { handler } = await createHandler({ plugins, config });
apolloHandler = handler;
}
return apolloHandler(event, context);
};
// @flow
import { createHandler, PluginsContainer } from "@webiny/api";
import servicePlugins from "@webiny/api/plugins/service";
import securityPlugins from "@webiny/api-security/plugins/service";
import headlessPlugins from "@webiny/api-headless/plugins";
import createConfig from "service-config";
const plugins = new PluginsContainer([servicePlugins, securityPlugins, headlessPlugins]);
export const handler = async (context: Object) => {
const config = await createConfig(context);
return await createHandler({ config, plugins });
};
export const handler = async (event, context) => {
if (!apolloHandler) {
const plugins = new PluginsContainer([]);
const { handler } = await createHandler({ plugins });
apolloHandler = handler;
}
return apolloHandler(event, context);
};
export const handler = async (event, context) => {
if (!apolloHandler) {
const plugins = new PluginsContainer([]);
const plugin = plugins.byName("create-apollo-gateway");
apolloHandler = await plugin.createGateway({ plugins });
}
return new Promise((resolve, reject) => {
apolloHandler(event, context, (error, data) => {
if (error) {
return reject(error);
}
resolve(data);
});
});
};
export const handler = async (event: Object, context: Object) => {
if (!apolloHandler) {
const config = await createConfig();
const plugins = new PluginsContainer([
servicePlugins,
securityPlugins,
i18nPlugins,
formsPlugins
]);
const { handler } = await createHandler({ plugins, config });
apolloHandler = handler;
}
return apolloHandler(event, context);
};
export const handler = async (event: Object, context: Object) => {
if (!apolloHandler) {
const config = await createConfig();
const plugins = new PluginsContainer([
securityPlugins,
i18nPlugins,
pageBuilderPlugins(config),
mailchimpPlugins(config),
gtmPlugins(config),
cookiePolicyPlugins(config)
]);
const { handler } = await createHandler({ plugins, config });
apolloHandler = handler;
}
return apolloHandler(event, context);
};
export const handler = async (event: Object, context: Object) => {
if (!apolloHandler) {
const config = await createConfig();
const plugins = new PluginsContainer([
/*securityPlugins,*/ i18nPlugins(config)
]);
const { handler } = await createHandler({ plugins, config });
apolloHandler = handler;
}
return apolloHandler(event, context);
};