Skip to content

Commit abfc148

Browse files
committed
[Doc/runtimes] update examples to match default values
1 parent fc4c28e commit abfc148

File tree

9 files changed

+68
-68
lines changed

9 files changed

+68
-68
lines changed

docs/README.md

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -164,67 +164,67 @@ Available runtimes are:
164164
#### Functions Handler
165165
166166
Based on the chosen runtime, the `handler` variable on function might vary:
167-
- `node` (8 or 10): Path to your handler file (from serverless.yml), omit `./`, `../`, suffixed by the exported function to use (example: `myFunction.myHandler` => file `myFunction.js` exports a function `myHandler`).
168-
```
169-
- src
170-
- handlers
171-
- firstHandler.js => module.exports.myFirstHandler
172-
- secondHandler.js => module.exports.mySecondHandler
173-
- serverless.yml
174-
```
175-
Inside serverless.yml:
176-
```yml
177-
provider:
178-
# ...
179-
runtime: node8 # or node10
180-
functions:
181-
first:
182-
handler: src/handlers/firstHandler.myFirstHandler
183-
second:
184-
handler: src/handlers/secondHandler.mySecondHandler
185-
```
186-
- `python` (2.7 and 3.7): Similar to `node`, path to handler file, suffixed with exported function to use: `src/testing/handler.my_handler` => file `handler.py` defines a method `my_handler`, inside directory `src/testing`.
187-
```
188-
- src
189-
- handlers
190-
- firstHandler.py => def my_first_handler
191-
- secondHandler.py => def my_second_handler
192-
- serverless.yml
193-
```
194-
Inside serverless.yml:
195-
```yml
196-
provider:
197-
# ...
198-
runtime: python3 # or python for python 2.7
199-
functions:
200-
first:
201-
handler: src/handlers/firstHandler.my_first_handler
202-
second:
203-
handler: src/handlers/secondHandler.my_second_handler
204-
```
167+
- `node` (8 or 10): Path to your handler file (from serverless.yml), omit `./`, `../`, suffixed by the exported function to use (example: `myFunction.handle` => file `myFunction.js` exports a function `handle`).
168+
```
169+
- src
170+
- handlers
171+
- firstHandler.js => module.exports.myFirstHandler
172+
- secondHandler.js => module.exports.mySecondHandler
173+
- serverless.yml
174+
```
175+
Inside serverless.yml:
176+
```yml
177+
provider:
178+
# ...
179+
runtime: node8 # or node10
180+
functions:
181+
first:
182+
handler: src/handlers/firstHandler.myFirstHandler
183+
second:
184+
handler: src/handlers/secondHandler.mySecondHandler
185+
```
186+
- `python` (2.7 and 3.7): Similar to `node`, path to handler file, suffixed with exported function to use: `src/testing/handler.handle` => file `handler.py` defines a method `handle`, inside directory `src/testing`.
187+
```
188+
- src
189+
- handlers
190+
- firstHandler.py => def my_first_handler
191+
- secondHandler.py => def my_second_handler
192+
- serverless.yml
193+
```
194+
Inside serverless.yml:
195+
```yml
196+
provider:
197+
# ...
198+
runtime: python3 # or python for python 2.7
199+
functions:
200+
first:
201+
handler: src/handlers/firstHandler.my_first_handler
202+
second:
203+
handler: src/handlers/secondHandler.my_second_handler
204+
```
205205
- `golang`: Path to your handler's **package**, for example if I have the following structure:
206-
```
207-
- src
208-
- testing
209-
- handler.go -> package main inside "src/testing" directory
210-
- second
211-
- handler.go -> package main inside "src/second" directory
212-
- handler.go -> package main at the root of the project
213-
- serverless.yml
214-
```
215-
Your serverless.yml `functions` should look something like this:
216-
```yml
217-
provider:
218-
# ...
219-
runtime: golang
220-
functions:
221-
root:
222-
handler: "."
223-
testing:
224-
handler: src/testing
225-
second:
226-
handler: src/second
227-
```
206+
```
207+
- src
208+
- testing
209+
- handler.go -> package main inside "src/testing" directory
210+
- second
211+
- handler.go -> package main inside "src/second" directory
212+
- handler.go -> package main at the root of the project
213+
- serverless.yml
214+
```
215+
Your serverless.yml `functions` should look something like this:
216+
```yml
217+
provider:
218+
# ...
219+
runtime: golang
220+
functions:
221+
root:
222+
handler: "."
223+
testing:
224+
handler: src/testing
225+
second:
226+
handler: src/second
227+
```
228228

229229
### Environment Variables
230230

examples/nodejs10/handler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports.myHandler = (event, context, callback) => {
1+
module.exports.handle = (event, context, callback) => {
22
const result = {
33
message: 'Hello from Serverless Framework and Scaleway Functions :D',
44
};

examples/nodejs10/serverless.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ package:
2121

2222
functions:
2323
first:
24-
handler: handler.myHandler
24+
handler: handler.handle
2525
# Local environment variables - used only in given function
2626
env:
2727
local: local

examples/nodejs8/handler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports.myHandler = (event, context, callback) => {
1+
module.exports.handle = (event, context, callback) => {
22
const result = {
33
message: 'Hello from Serverless Framework and Scaleway Functions :D',
44
};

examples/nodejs8/serverless.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ package:
2121

2222
functions:
2323
first:
24-
handler: handler.myHandler
24+
handler: handler.handle
2525
# Local environment variables - used only in given function
2626
env:
2727
local: local

examples/python2/handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def my_handler(event, context):
1+
def handle(event, context):
22
"""handle a request to the function
33
Args:
44
req (dict): request body

examples/python2/serverless.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ package:
2222

2323
functions:
2424
first:
25-
handler: handler.my_handler
25+
handler: handler.handle
2626
# Local environment variables - used only in given function
2727
env:
2828
local: local

examples/python3/handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def my_handler(event, context):
1+
def handle(event, context):
22
"""handle a request to the function
33
Args:
44
event (dict): request params

examples/python3/serverless.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ package:
2222

2323
functions:
2424
first:
25-
handler: handler.my_handler
25+
handler: handler.handle
2626
# Local environment variables - used only in given function
2727
env:
2828
local: local

0 commit comments

Comments
 (0)