This repository has been archived by the owner on Oct 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserverless.yml
90 lines (81 loc) · 4.08 KB
/
serverless.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/
service: serverless-ets-boilerplate
frameworkVersion: '2'
# Important: `serverless login` first if it is your first `serverless` setup.
# org: brifiction
# app: serverless-ets-boilerplate
# Create an optimized package for our functions
package:
individually: true
# Using .env file
useDotenv: true
# Provider defined as "AWS"
provider:
name: aws
runtime: nodejs14.x
lambdaHashingVersion: '20201221'
environment:
STAGE: ${opt:stage, 'development'}
region: ap-southeast-2
httpApi:
name: ${sls:stage}-${self:service} # Use custom name for the API Gateway API, default is ${sls:stage}-${self:service}
cors: true
# Serverless plugins used
plugins:
- serverless-bundle
- serverless-offline
- serverless-dotenv-plugin
# Defined serverless functions - express api routes
functions:
api:
name: ${sls:stage}-lambdaName # optional, Deployed Lambda name
description: A serverless + express + typescript demo project.
handler: handler.api
events:
- httpApi:
method: '*'
path: '/{proxy+}'
memorySize: 512 # optional, in MB, default is 1024
timeout: 10 # optional, in seconds, default is 6
custom:
dotenv:
include:
- DEBUG
- ENVIRONMENT
bundle:
# sourcemaps: true # Enable source maps
# caching: true # Enable Webpack caching
# stats: false # Don't print out any Webpack output
linting: false # Enable linting as a part of the build process
# disableForkTsChecker: false # Disable the ForkTsChecker plugin, more below
# tsConfig: "tsconfig.json" # Path to your 'tsconfig.json', if it's not in the root
# forceInclude: # Optional list of NPM packages that need to be included
# - mysql # Only necessary if packages are included dynamically
# ignorePackages: # Ignore building any of the following packages
# - hiredis # For ex, hiredis needs to be ignored if using redis
# externals: # Set non Webpack compatible packages as externals
# - isomorphic-webcrypto # They'll be included in the node_modules/, more below
# forceExclude: # Don't include these in the package
# - chrome-aws-lambda # Because it'll be provided through a Lambda Layer
# excludeFiles: "**/*.test.ts" # Exclude files from Webpack that match the glob
# fixPackages: # Include fixes for specific packages
# - "[email protected]" # For ex, [email protected] doesn't work by default with Webpack
# copyFiles: # Copy any additional files to the generated package
# - from: 'public/*' # Where the files are currently
# to: './' # Where in the package should they go
# aliases: # Create an alias to 'import' modules easily with a custom path
# - Lib: custom-lib/src/lib # For ex, replace the long 'custom-lib/src/lib' with 'Lib'
# concatText: # Concatenate text files into one file on the generated package
# - files: 'schema/*.txt' # Where the files that need to be concatenated are currently located
# outputPath: './' # Where the concatenated file should go in the package
# name: 'schema.txt' # The name the the concatenated file should have
packager: yarn # Specify a packager, 'npm' or 'yarn'. Defaults to 'npm'.
# packagerOptions: # Run a custom script in the package process
# scripts: # https://github.com/serverless-heaven/serverless-webpack#custom-scripts
# - echo hello > test
# rawFileExtensions: # An array of file extensions to import using the Webpack raw-loader.
# - csv # Defaults to ['pem', 'txt']
serverless-offline:
# useDocker: true
httpPort: 5001
lambdaPort: 3005