refactor: move types into single file
This commit is contained in:
parent
25dbad0f3b
commit
7fad4874ce
16
src/app.ts
16
src/app.ts
@ -3,8 +3,9 @@ import { ConfigService } from "./config/config.service";
|
||||
import NodeCache from "node-cache";
|
||||
import { readability } from "./handlers/readability";
|
||||
import minify from "./handlers/main";
|
||||
import Fastify, { FastifyRequest } from "fastify";
|
||||
import Fastify from "fastify";
|
||||
import middie from "@fastify/middie";
|
||||
import { Cached, EngineRequest, GetRequest } from "./schema/requests.types";
|
||||
class App {
|
||||
config: IConfigService;
|
||||
cache: NodeCache;
|
||||
@ -74,18 +75,5 @@ class App {
|
||||
}
|
||||
}
|
||||
|
||||
type GetRequest = FastifyRequest<{
|
||||
Querystring: { url: string; type?: string };
|
||||
}>;
|
||||
|
||||
type EngineRequest = FastifyRequest<{
|
||||
Querystring: { url: string };
|
||||
}>;
|
||||
|
||||
type Cached = {
|
||||
content: string;
|
||||
contentType: string;
|
||||
};
|
||||
|
||||
const app = new App();
|
||||
app.init();
|
||||
|
14
src/schema/requests.types.ts
Normal file
14
src/schema/requests.types.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { FastifyRequest } from "fastify";
|
||||
|
||||
export type GetRequest = FastifyRequest<{
|
||||
Querystring: { url: string; type?: string };
|
||||
}>;
|
||||
|
||||
export type EngineRequest = FastifyRequest<{
|
||||
Querystring: { url: string };
|
||||
}>;
|
||||
|
||||
export type Cached = {
|
||||
content: string;
|
||||
contentType: string;
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user