diff --git a/package.json b/package.json index 05c9e9bbc66d89e845e9a56d81269986f6b2e63c..8f958309ba4ee74946c8e73d4eff743aad693370 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "@types/better-sqlite3": "^5.4.1", "@types/chai": "^4.2.11", "@types/command-line-args": "^5.0.0", + "@types/express": "^4.17.9", "@types/js-yaml": "^3.12.4", "@types/marked": "^1.1.0", "@types/mime": "^2.0.2", diff --git a/src/discordas.ts b/src/discordas.ts index c92cbfe24d571da90315075be6c9d8b7495398f8..d56bc1fe892c91bc8ab4a6f775d779e55e938956 100644 --- a/src/discordas.ts +++ b/src/discordas.ts @@ -26,6 +26,7 @@ import * as usage from "command-line-usage"; import { v4 as uuid } from "uuid"; import { IMatrixEvent } from "./matrixtypes"; import { MetricPeg, PrometheusBridgeMetrics } from "./metrics"; +import { Response } from "express"; const log = new Log("DiscordAS"); @@ -176,6 +177,15 @@ async function run() { const roomhandler = discordbot.RoomHandler; const eventProcessor = discordbot.MxEventProcessor; + // 2020-12-07: If this fails to build in TypeScript with + // "Namespace 'serveStatic' has no exported member 'RequestHandlerConstructor'.", + // remove @types/express-serve-static-core and @types/serve-static from yarn.lock + // and run yarn. + // See https://github.com/DefinitelyTyped/DefinitelyTyped/issues/49595 + appservice.expressAppInstance.get("/health", (_, res: Response) => { + res.status(200).send(""); + }); + // tslint:disable-next-line:no-any appservice.on("query.room", async (roomAlias: string, createRoom: (opts: any) => Promise<void>) => { try { diff --git a/yarn.lock b/yarn.lock index c96ca550ff7753bf9d36ad7b52a7516ff020d0e6..138ce0e20135a001e4a73d009768e1f2ccf1f31e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -278,9 +278,9 @@ "@types/node" "*" "@types/express-serve-static-core@*": - version "4.17.13" - resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.13.tgz#d9af025e925fc8b089be37423b8d1eac781be084" - integrity sha512-RgDi5a4nuzam073lRGKTUIaL3eF2+H7LJvJ8eUnCI0wA6SNjXc44DCmWNiTLs/AZ7QlsFWZiw/gTG3nSQGL0fA== + version "4.17.14" + resolved "https://registry.yarnpkg.com/@types/express-serve-static-core/-/express-serve-static-core-4.17.14.tgz#cabf91debeeb3cb04b798e2cff908864e89b6106" + integrity sha512-uFTLwu94TfUFMToXNgRZikwPuZdOtDgs3syBtAIr/OXorL1kJqUJT9qCLnRZ5KBOWfZQikQ2xKgR2tnDj1OgDA== dependencies: "@types/node" "*" "@types/qs" "*" @@ -296,6 +296,16 @@ "@types/qs" "*" "@types/serve-static" "*" +"@types/express@^4.17.9": + version "4.17.9" + resolved "https://registry.yarnpkg.com/@types/express/-/express-4.17.9.tgz#f5f2df6add703ff28428add52bdec8a1091b0a78" + integrity sha512-SDzEIZInC4sivGIFY4Sz1GG6J9UObPwCInYJjko2jzOf/Imx/dlpume6Xxwj1ORL82tBbmN4cPDIDkLbWHk9hw== + dependencies: + "@types/body-parser" "*" + "@types/express-serve-static-core" "*" + "@types/qs" "*" + "@types/serve-static" "*" + "@types/http-cache-semantics@*": version "4.0.0" resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.0.tgz#9140779736aa2655635ee756e2467d787cfe8a2a" @@ -374,9 +384,9 @@ "@types/node" "*" "@types/serve-static@*": - version "1.13.6" - resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.6.tgz#866b1b8dec41c36e28c7be40ac725b88be43c5c1" - integrity sha512-nuRJmv7jW7VmCVTn+IgYDkkbbDGyIINOeu/G0d74X3lm6E5KfMeQPJhxIt1ayQeQB3cSxvYs1RA/wipYoFB4EA== + version "1.13.8" + resolved "https://registry.yarnpkg.com/@types/serve-static/-/serve-static-1.13.8.tgz#851129d434433c7082148574ffec263d58309c46" + integrity sha512-MoJhSQreaVoL+/hurAZzIm8wafFR6ajiTM1m4A0kv6AGeVBl4r4pOV8bGFrjjq1sGxDTnCoF8i22o0/aE5XCyA== dependencies: "@types/mime" "*" "@types/node" "*"