Skip to content

Commit fa64933

Browse files
committed
chore(http): fix method overload when lambda is true
1 parent e065f48 commit fa64933

File tree

4 files changed

+257
-5
lines changed

4 files changed

+257
-5
lines changed

package-lock.json

Lines changed: 248 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@athenna/core",
3-
"version": "5.22.0",
3+
"version": "5.23.0",
44
"description": "One foundation for multiple applications.",
55
"license": "MIT",
66
"author": "João Lenon <[email protected]>",
@@ -91,8 +91,10 @@
9191
"@athenna/test": "^5.5.0",
9292
"@athenna/tsconfig": "^5.0.0",
9393
"@athenna/view": "^5.4.0",
94+
"@types/aws-lambda": "^8.10.152",
9495
"@typescript-eslint/eslint-plugin": "^7.18.0",
9596
"@typescript-eslint/parser": "^7.18.0",
97+
"aws-lambda": "^1.0.7",
9698
"commitizen": "^4.3.1",
9799
"cz-conventional-changelog": "^3.3.0",
98100
"eslint": "^8.57.1",

src/applications/Http.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { Log } from '@athenna/logger'
1212
import type { ServerImpl } from '@athenna/http'
1313
import type { HttpOptions } from '#src/types/HttpOptions'
1414
import { Is, Path, Module, Options } from '@athenna/common'
15+
import type { Handler as AWSLambdaHandler } from 'aws-lambda'
1516

1617
export class Http {
1718
/**
@@ -31,10 +32,13 @@ export class Http {
3132
return server
3233
}
3334

35+
public static async boot(options: HttpOptions & { isAWSLambda: true }): Promise<AWSLambdaHandler>
36+
public static async boot(options?: HttpOptions): Promise<ServerImpl>
37+
3438
/**
3539
* Boot the Http application.
3640
*/
37-
public static async boot(options?: HttpOptions): Promise<ServerImpl> {
41+
public static async boot(options?: HttpOptions): Promise<ServerImpl | AWSLambdaHandler> {
3842
options = Options.create(options, {
3943
initOnly: false,
4044
isAWSLambda: false,

tests/unit/applications/HttpTest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export default class HttpTest {
136136
Server.when('listen').resolve(undefined)
137137

138138
await Http.boot({ host: '::1' })
139-
139+
140140
assert.calledOnceWith(Server.listen, { host: '::1', port: 3000 })
141141
assert.calledWith(successMock, 'Http server started on ({yellow} localhost:3000)')
142142
assert.calledWith(successMock, 'Kernel ({yellow} HttpKernel) successfully booted')

0 commit comments

Comments
 (0)