Skip to content

Instantly share code, notes, and snippets.

@sergioramos
Created June 2, 2022 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergioramos/3132b23ab81ed049761d0f58c229163a to your computer and use it in GitHub Desktop.
Save sergioramos/3132b23ab81ed049761d0f58c229163a to your computer and use it in GitHub Desktop.
const { name: service } = require('./package.json');
const { INDIVIDUALLY = '0', NCC = '0' } = process.env;
const IS_INDIVIDUALLY = Boolean(JSON.parse(INDIVIDUALLY));
const IS_NCC = Boolean(JSON.parse(NCC));
module.exports = {
service,
plugins: [IS_NCC && 'serverless-plugin-ncc'].filter(Boolean),
provider: {
name: 'aws',
runtime: 'nodejs10.x',
// eslint-disable-next-line no-template-curly-in-string
region: '${env:AWS_REGION, "eu-west-3"}',
// eslint-disable-next-line no-template-curly-in-string
stage: '${opt:stage, "development"}',
environment: {
// eslint-disable-next-line no-template-curly-in-string
NODE_ENV: '${env:NODE_ENV, "development"}',
},
},
package: {
individually: IS_INDIVIDUALLY,
excludeDevDependencies: !IS_NCC,
},
custom: {
ncc: {
// we can ignore aws-sdk because the node runtime in lambda automatically include is
externals: ['aws-sdk/clients/s3'],
},
},
functions: {
GraphQL: {
handler: 'graphql.handler',
events: [
{
http: {
path: '/graphql',
method: 'POST',
},
},
],
},
Playground: {
handler: 'playground.handler',
events: [
{
http: {
path: '/playground',
method: 'GET',
},
},
],
},
Upload: {
handler: 'upload.handler',
events: [
{
http: {
path: '/upload',
method: 'POST',
},
},
],
},
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment