Skip to content

Commit 7513024

Browse files
authored
Merge pull request #259 from AthennaIO/develop
chore(http): fix method overload when lambda is true
2 parents 7b2494b + 343a74c commit 7513024

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

package-lock.json

Lines changed: 2 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@athenna/core",
3-
"version": "5.23.0",
3+
"version": "5.24.0",
44
"description": "One foundation for multiple applications.",
55
"license": "MIT",
66
"author": "João Lenon <[email protected]>",

src/applications/Http.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,18 @@ export class Http {
3232
return server
3333
}
3434

35-
public static async boot(options: HttpOptions & { isAWSLambda: true }): Promise<AWSLambdaHandler>
35+
public static async boot(
36+
options: HttpOptions & { isAWSLambda: true }
37+
): Promise<AWSLambdaHandler>
38+
3639
public static async boot(options?: HttpOptions): Promise<ServerImpl>
3740

3841
/**
3942
* Boot the Http application.
4043
*/
41-
public static async boot(options?: HttpOptions): Promise<ServerImpl | AWSLambdaHandler> {
44+
public static async boot(
45+
options?: HttpOptions
46+
): Promise<ServerImpl | AWSLambdaHandler> {
4247
options = Options.create(options, {
4348
initOnly: false,
4449
isAWSLambda: false,

src/ignite/Ignite.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import type {
1818
import { Ioc } from '@athenna/ioc'
1919
import { Cron } from '#src/applications/Cron'
2020
import { Http } from '#src/applications/Http'
21+
import type { ServerImpl } from '@athenna/http'
2122
import { EnvHelper, Rc } from '@athenna/config'
2223
import { isAbsolute, resolve } from 'node:path'
2324
import type { ReplImpl } from '#src/repl/ReplImpl'
@@ -26,6 +27,7 @@ import { CommanderHandler } from '@athenna/artisan'
2627
import { LoadHelper } from '#src/helpers/LoadHelper'
2728
import { Log, LoggerProvider } from '@athenna/logger'
2829
import { Repl as ReplApp } from '#src/applications/Repl'
30+
import type { Handler as AWSLambdaHandler } from 'aws-lambda'
2931
import { parse as semverParse, satisfies as semverSatisfies } from 'semver'
3032
import { Is, Path, File, Module, Options, Macroable } from '@athenna/common'
3133
import { NotSatisfiedNodeVersion } from '#src/exceptions/NotSatisfiedNodeVersion'
@@ -134,10 +136,13 @@ export class Ignite extends Macroable {
134136
}
135137
}
136138

139+
public async httpServer(options: HttpOptions & { isAWSLambda: true }): Promise<AWSLambdaHandler>
140+
public async httpServer(options?: HttpOptions): Promise<ServerImpl>
141+
137142
/**
138143
* Ignite the Http server application.
139144
*/
140-
public async httpServer(options?: HttpOptions) {
145+
public async httpServer(options?: HttpOptions): Promise<ServerImpl | AWSLambdaHandler> {
141146
try {
142147
this.options.environments.push('http')
143148

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)