// generated by @ng-toolkit/serverless import { APIGatewayEvent, Context } from 'aws-lambda'; import awsServerlessExpress from 'aws-serverless-express'; import awsServerlessExpressMiddleware from 'aws-serverless-express/middleware'; import { Server } from 'http'; import { app } from './dist/server'; // NOTE: If you get ERR_CONTENT_DECODING_FAILED in your browser, this is likely // due to a compressed response (e.g. gzip) which has not been handled correctly // by aws-serverless-express and/or API Gateway. Add the necessary MIME types to // binaryMimeTypes below, then redeploy (`npm run build:prod:deploy`) const binaryMimeTypes: string[] = [ 'application/javascript', 'application/json', 'application/octet-stream', 'application/xml', 'image/jpeg', 'image/png', 'image/gif', 'text/comma-separated-values', 'text/css', 'text/html', 'text/javascript', 'text/plain', 'text/text', 'text/xml', 'image/x-icon', 'image/svg+xml', 'font/ttf', 'font/woff', 'font/woff2', ]; const serverExpress = app(); serverExpress.use(awsServerlessExpressMiddleware.eventContext()); const serverProxy: Server = awsServerlessExpress.createServer(serverExpress, null, binaryMimeTypes); // Export the handler : the entry point of the Lambda function export function universal(event: APIGatewayEvent, context: Context): Server { return awsServerlessExpress.proxy(serverProxy, event, context); }