Skip to content

Instantly share code, notes, and snippets.

@viktorfa

viktorfa/app.js

Last active Sep 24, 2020
Embed
What would you like to do?
Entry point for Serverless Strapi with serverless-http
const startStrapi = require("strapi/lib/Strapi");
const serverless = require("serverless-http");
module.exports.handler = async (event, context) => {
if (!global.strapi) {
console.log("Cold starting Strapi");
await startStrapi({ dir: __dirname }).start();
}
const handler = serverless(global.strapi.app);
return handler(event, context);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment