summary refs log tree commit diff
path: root/src/Server.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-05-31 21:03:09 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-05-31 21:03:09 +0200
commit491565aef88ce08444bba83a571c1a5006271f56 (patch)
tree35f8ad586e01036ca34ff2ce1ee26b7d4eb42d99 /src/Server.ts
parent:construction: dm channels (diff)
downloadserver-491565aef88ce08444bba83a571c1a5006271f56.tar.xz
:zap: add explicit types to req and res
Diffstat (limited to 'src/Server.ts')
-rw-r--r--src/Server.ts14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Server.ts b/src/Server.ts

index 50110bec..5ae65918 100644 --- a/src/Server.ts +++ b/src/Server.ts
@@ -9,8 +9,8 @@ import i18nextMiddleware, { I18next } from "i18next-http-middleware"; import i18nextBackend from "i18next-node-fs-backend"; import { ErrorHandler } from "./middlewares/ErrorHandler"; import { BodyParser } from "./middlewares/BodyParser"; -import express, { Router } from "express"; -import fetch, { Response } from "node-fetch"; +import express, { Router, Request, Response } from "express"; +import fetch, { Response as FetchResponse } from "node-fetch"; import mongoose from "mongoose"; import path from "path"; @@ -31,13 +31,13 @@ declare global { const assetCache = new Map< string, { - response: Response; + response: FetchResponse; buffer: Buffer; } >(); export class FosscordServer extends Server { - public options: FosscordServerOptions; + public declare options: FosscordServerOptions; constructor(opts?: Partial<FosscordServerOptions>) { // @ts-ignore @@ -101,9 +101,9 @@ export class FosscordServer extends Server { this.app.use("/assets", express.static(path.join(__dirname, "..", "assets"))); - this.app.get("/assets/:file", async (req, res) => { + this.app.get("/assets/:file", async (req: Request, res: Response) => { delete req.headers.host; - var response: Response; + var response: FetchResponse; var buffer: Buffer; const cache = assetCache.get(req.params.file); if (!cache) { @@ -140,7 +140,7 @@ export class FosscordServer extends Server { return res.send(buffer); }); - this.app.get("*", (req, res) => { + this.app.get("*", (req: Request, res: Response) => { res.set("Cache-Control", "public, max-age=" + 60 * 60 * 24); res.set("content-type", "text/html"); res.send(