Skip to content

Commit

Permalink
refactor: examples
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Aug 27, 2022
1 parent 888678b commit 83835dd
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 14 deletions.
6 changes: 3 additions & 3 deletions examples/events/http/handler.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict'

const { env } = require('node:process')

const { stringify } = JSON

exports.hello = async function hello() {
return {
body: stringify({ foo: 'bar', IS_OFFLINE: env.IS_OFFLINE }),
body: stringify({
foo: 'bar',
}),
statusCode: 200,
}
}
6 changes: 3 additions & 3 deletions examples/events/httpApi/handler.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict'

const { env } = require('node:process')

const { stringify } = JSON

exports.hello = async function hello() {
return {
body: stringify({ foo: 'bar', IS_OFFLINE: env.IS_OFFLINE }),
body: stringify({
foo: 'bar',
}),
statusCode: 200,
}
}
4 changes: 3 additions & 1 deletion examples/lambda-invoke/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ const lambda = new Lambda({
})

exports.hello = async function hello() {
const clientContextData = stringify({ foo: 'foo' })
const clientContextData = stringify({
foo: 'foo',
})

const params = {
ClientContext: Buffer.from(clientContextData).toString('base64'),
Expand Down
4 changes: 3 additions & 1 deletion examples/tools/babel-register/src/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ const { stringify } = JSON

export async function hello() {
return {
body: stringify({ hello: '@babel/register' }),
body: stringify({
hello: '@babel/register',
}),
statusCode: 200,
}
}
4 changes: 3 additions & 1 deletion examples/tools/nodemon/src/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ const { stringify } = JSON

exports.hello = async function hello() {
return {
body: stringify({ hello: 'nodemon' }),
body: stringify({
hello: 'nodemon',
}),
statusCode: 200,
}
}
4 changes: 3 additions & 1 deletion examples/tools/serverless-plugin-typescript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ const { stringify } = JSON
export const hello: Handler<APIGatewayProxyEvent, APIGatewayProxyResult> =
async function serverlessWebpack(event, context, callback) {
return {
body: stringify({ hello: 'serverless-plugin-typescript!' }),
body: stringify({
hello: 'serverless-plugin-typescript!',
}),
statusCode: 200,
}
}
6 changes: 4 additions & 2 deletions examples/tools/serverless-webpack/src/handler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
APIGatewayProxyEvent,
APIGatewayProxyResult,
Handler,
Expand All @@ -9,7 +9,9 @@ const { stringify } = JSON
export const hello: Handler<APIGatewayProxyEvent, APIGatewayProxyResult> =
async function hello(event, context, callback) {
return {
body: stringify({ hello: 'serverless-webpack' }),
body: stringify({
hello: 'serverless-webpack',
}),
statusCode: 200,
}
}
6 changes: 4 additions & 2 deletions examples/tools/ts-node/src/handler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
APIGatewayProxyEvent,
APIGatewayProxyResult,
Handler,
Expand All @@ -9,7 +9,9 @@ const { stringify } = JSON
export const hello: Handler<APIGatewayProxyEvent, APIGatewayProxyResult> =
async function hello(event, context, callback) {
return {
body: stringify({ hello: 'ts-node' }),
body: stringify({
hello: 'ts-node',
}),
statusCode: 200,
}
}

0 comments on commit 83835dd

Please sign in to comment.