mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
add hello-world template
This commit is contained in:
parent
e5e54ef49a
commit
deaa030a6d
6
lib/plugins/create/templates/hello-world/gitignore
Normal file
6
lib/plugins/create/templates/hello-world/gitignore
Normal file
@ -0,0 +1,6 @@
|
||||
# package directories
|
||||
node_modules
|
||||
jspm_packages
|
||||
|
||||
# Serverless directories
|
||||
.serverless
|
||||
16
lib/plugins/create/templates/hello-world/handler.js
Normal file
16
lib/plugins/create/templates/hello-world/handler.js
Normal file
@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
module.exports.helloWorld = (event, context, callback) => {
|
||||
const response = {
|
||||
statusCode: 200,
|
||||
headers: {
|
||||
"Access-Control-Allow-Origin" : "*" // Required for CORS support to work
|
||||
},
|
||||
body: JSON.stringify({
|
||||
message: 'Go Serverless v1.0! Your function executed successfully!',
|
||||
input: event,
|
||||
}),
|
||||
};
|
||||
|
||||
callback(null, response);
|
||||
};
|
||||
24
lib/plugins/create/templates/hello-world/serverless.yml
Normal file
24
lib/plugins/create/templates/hello-world/serverless.yml
Normal file
@ -0,0 +1,24 @@
|
||||
# Welcome to serverless. Read the docs
|
||||
# https://serverless.com/framework/docs/
|
||||
|
||||
# Serverless.yml is the configuration the CLI
|
||||
# uses to deploy your code to your provider of choice
|
||||
|
||||
# The `service` block is the name of the service
|
||||
service: serverless-hello-world
|
||||
|
||||
# The `provider` block defines where your service will be deployed
|
||||
provider:
|
||||
name: aws
|
||||
runtime: nodejs6.10
|
||||
|
||||
# The `functions` block defines what code to deploy
|
||||
functions:
|
||||
helloWorld:
|
||||
handler: handler.helloWorld
|
||||
# The `events` block defines how to trigger the handler.helloWorld code
|
||||
events:
|
||||
- http:
|
||||
path: hello
|
||||
method: get
|
||||
cors: true
|
||||
Loading…
x
Reference in New Issue
Block a user