You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-5Lines changed: 10 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,6 @@ This uses the [serverless-webpack](https://github.com/elastic-coders/serverless-
6
6
7
7
-**ES7 syntax in your handler functions**
8
8
- Use async/await
9
-
- The spread operator
10
9
- And much more!
11
10
-**Sourcemaps for proper error messages**
12
11
- Error message show the correct line numbers
@@ -20,7 +19,7 @@ If you'd like to learn how to setup your existing Serverless project to support
20
19
21
20
### Demo
22
21
23
-
A demo version of this service is hosted on AWS - [`https://ndgmy14knc.execute-api.us-east-1.amazonaws.com/dev/hello`](https://ndgmy14knc.execute-api.us-east-1.amazonaws.com/dev/hello)
22
+
A demo version of this service is hosted on AWS - [`https://ndgmy14knc.execute-api.us-east-1.amazonaws.com/dev/hello`](https://2njfspcvna.execute-api.us-east-1.amazonaws.com/dev/hello)
24
23
25
24
And here is the ES7 source behind it
26
25
@@ -74,22 +73,28 @@ $ npm install
74
73
To run a function on your local
75
74
76
75
```bash
77
-
$ serverless webpack invoke --function hello
76
+
$ serverless invokelocal --function hello
78
77
```
79
78
80
-
And to deploy
79
+
Deploy your project
81
80
82
81
```bash
83
82
$ serverless deploy
84
83
```
85
84
85
+
Deploy a single function
86
+
87
+
```bash
88
+
$ serverless deploy function--function hello
89
+
```
90
+
86
91
To add another function as a new file to your project, simply add the new file and add the reference to `serverless.yml`. The `webpack.config.js` automatically handles functions in different files.
87
92
88
93
### How It Works
89
94
90
95
To ensure that you get all the ES7 capabilities while showing proper error messages and seamlessly integrating with the rest of your project, we do the following:
91
96
92
-
- The `webpack.config.js` loads all your handlers from the `serverless.yml` and transpiles them using Babel. This means that you don't have to edit the `webpack.config.js` when you add a new handler file.
97
+
- The `webpack.config.js` loads all your handlers using the `slsw.lib.entries` from the serverless-webpack plugin. This means that you don't have to edit the `webpack.config.js` when you add a new handler file.
93
98
- Generate the sourcemaps for all the transpiled files and load the sourcemaps in each of the handler files.
94
99
- Catch and log any unhandled exceptions to ensure that async functions can log errors.
0 commit comments