Created
June 2, 2022 13:22
-
-
Save sergioramos/3132b23ab81ed049761d0f58c229163a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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