lambda.js 927 B

1234567891011121314151617181920212223242526272829303132
  1. 'use strict';
  2. const awsServerlessExpress = require('aws-serverless-express');
  3. const app = require('./app');
  4. // NOTE: If you get ERR_CONTENT_DECODING_FAILED in your browser, this is likely
  5. // due to a compressed response (e.g. gzip) which has not been handled correctly
  6. // by aws-serverless-express and/or API Gateway. Add the necessary MIME types to
  7. // binaryMimeTypes below, then redeploy (`npm run package-deploy`)
  8. const binaryMimeTypes = [
  9. 'application/javascript',
  10. 'application/json',
  11. 'application/octet-stream',
  12. 'application/xml',
  13. 'font/eot',
  14. 'font/opentype',
  15. 'font/otf',
  16. 'image/jpeg',
  17. 'image/png',
  18. 'image/svg+xml',
  19. 'text/comma-separated-values',
  20. 'text/css',
  21. 'text/html',
  22. 'text/javascript',
  23. 'text/plain',
  24. 'text/text',
  25. 'text/xml',
  26. ];
  27. const server = awsServerlessExpress.createServer(app, null, binaryMimeTypes);
  28. exports.handler = (event, context) => awsServerlessExpress.proxy(server, event, context);