-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
292 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
.aws_lambda | ||
.serverless | ||
.DS_Store | ||
/**/*/.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"tabWidth": 2, | ||
"semi": true, | ||
"singleQuote": false, | ||
"printWidth": 180, | ||
"bracketSpacing": true, | ||
"endOfLine": "lf" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare const _default: any; | ||
export default _default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { defineConfig } from "serverless-aws-lambda/defineConfig"; | ||
import { vitestPlugin } from "serverless-aws-lambda-vitest"; | ||
|
||
const test = process.argv.includes("vitest"); | ||
const oneshot = test && process.argv.includes("oneshot"); | ||
export default defineConfig({ | ||
esbuild: { | ||
format: "esm", | ||
}, | ||
offline: { | ||
port: 7500, | ||
}, | ||
plugins: [test && vitestPlugin({ configFile: "./vitest.e2e.config.mts", oneshot })], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "my-project", | ||
"license": "UNLICENSED", | ||
"type": "module", | ||
"devDependencies": { | ||
"prettier": "3.0.1", | ||
"serverless": "^3.34.0", | ||
"serverless-aws-lambda": "^4.6.2", | ||
"serverless-aws-lambda-vitest": "^1.2.5", | ||
"typescript": "^5.1.6" | ||
}, | ||
"scripts": { | ||
"sls": "sls", | ||
"tsc": "tsc", | ||
"start": "SLS_DEBUG=* sls aws-lambda -s dev", | ||
"test": "sls aws-lambda -s dev vitest", | ||
"deploy": "SLS_DEBUG=* sls deploy -s dev", | ||
"format": "prettier --write ." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
service: my-project | ||
|
||
plugins: | ||
- serverless-aws-lambda | ||
|
||
package: | ||
individually: true | ||
|
||
provider: | ||
name: aws | ||
stage: ${opt:stage, 'dev'} | ||
region: eu-west-3 | ||
runtime: nodejs18.x | ||
architecture: arm64 | ||
memorySize: 512 | ||
versionFunctions: false | ||
|
||
custom: | ||
serverless-aws-lambda: | ||
configPath: config/sls.ts | ||
|
||
functions: | ||
helloWorld: | ||
handler: src/lambda/helloWorld.default | ||
events: | ||
- httpApi: | ||
method: GET | ||
path: /sayhello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
declare const _default: (event: any, context: any) => Promise<{ | ||
statusCode: number; | ||
header: { | ||
"Content-Type": string; | ||
}; | ||
body: string; | ||
}>; | ||
export default _default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export default async (event, context) => { | ||
const name = event.queryStringParameters?.name ?? "World"; | ||
return { | ||
statusCode: 200, | ||
header: { | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify({ message: `Hello ${name}!` }), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const baseURL = `http://localhost:${LOCAL_PORT}`; | ||
|
||
describe("Test HelloWorld Lambda", () => { | ||
it("should say 'Hello John!'", async () => { | ||
const res = await fetch(`${baseURL}/sayhello?name=John`); | ||
const json = await res.json(); | ||
|
||
expect(json.message).toBe("Hello John!"); | ||
}); | ||
|
||
it("should say 'Hello World!'", async () => { | ||
const res = await fetch(`${baseURL}/sayhello`); | ||
const json = await res.json(); | ||
|
||
expect(json.message).toBe("Hello World!"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2022", | ||
"module": "ES2022", | ||
"moduleResolution": "Bundler", | ||
"esModuleInterop": true, | ||
"isolatedModules": true, | ||
"verbatimModuleSyntax": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"noEmit": true, | ||
"skipLibCheck": true, | ||
"resolveJsonModule": true, | ||
"types": ["vitest/globals"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare const _default: any; | ||
export default _default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { defineConfig } from "vitest/config"; | ||
|
||
export default defineConfig({ | ||
test: { | ||
include: ["./test/e2e/**/*.test.*"], | ||
globals: true, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.