11import type { Context , ServiceSchema } from "moleculer" ;
2- import type { IncomingRequest , ServerResponse } from "http" ;
2+ import type { IncomingMessage , ServerResponse } from "http" ;
33
44import ApiGateway from "moleculer-web" ;
55import type { ApiSettingsSchema } from "moleculer-web" ;
@@ -47,7 +47,7 @@ const ApiService: ServiceSchema<ApiSettingsSchema> = {
4747 { { / apiGQL } }
4848 ] ,
4949
50- /** @type { ApiSettingsSchema } More info: https://moleculer.services/docs/0.15/moleculer-web.html */
50+ /** More info: https://moleculer.services/docs/0.15/moleculer-web.html */
5151 settings : {
5252 // Exposed port
5353 port : process . env . PORT || 3000 ,
@@ -88,7 +88,7 @@ const ApiService: ServiceSchema<ApiSettingsSchema> = {
8888 onBeforeCall(
8989 ctx: Context<unknown, Meta>,
9090 route: Route,
91- req: IncomingRequest ,
91+ req: IncomingMessage ,
9292 res: GatewayResponse,
9393 ): void {
9494 // Set request headers to context meta
@@ -101,7 +101,7 @@ const ApiService: ServiceSchema<ApiSettingsSchema> = {
101101 onAfterCall(
102102 ctx: Context,
103103 route: Route,
104- req: IncomingRequest ,
104+ req: IncomingMessage ,
105105 res: GatewayResponse,
106106 data: unknown,
107107 ): unknown {
@@ -146,7 +146,6 @@ const ApiService: ServiceSchema<ApiSettingsSchema> = {
146146 options : { }
147147 }
148148
149- /** @type {import('moleculer-io').IOSetting } */
150149 // io: {},
151150 } ,
152151
@@ -164,7 +163,7 @@ const ApiService: ServiceSchema<ApiSettingsSchema> = {
164163 authenticate (
165164 ctx : Context ,
166165 route : Route ,
167- req : IncomingRequest ,
166+ req : IncomingMessage ,
168167 ) : Record < string , unknown > | null {
169168 // Read the token from header
170169 const auth = req . headers [ "authorization" ] ;
@@ -194,7 +193,7 @@ const ApiService: ServiceSchema<ApiSettingsSchema> = {
194193 *
195194 * PLEASE NOTE, IT'S JUST AN EXAMPLE IMPLEMENTATION. DO NOT USE IN PRODUCTION!
196195 */
197- authorize ( ctx : Context < null , Meta > , route : Route , req : IncomingRequest ) {
196+ authorize ( ctx : Context < null , Meta > , route : Route , req : IncomingMessage ) {
198197 // Get the authenticated user.
199198 const user = ctx . meta . user ;
200199
0 commit comments