aboutsummaryrefslogtreecommitdiff
path: root/packages/server/src/types
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-08-18 17:29:55 +0200
committerHampusM <hampus@hampusmat.com>2021-08-18 17:29:55 +0200
commitd1a1b7dc947063aef5f8375a6a1e03246b272c84 (patch)
treef5cb9bd6d4b5463d9d022026ac6fea87cb6ebe02 /packages/server/src/types
parent6ed078de30a7bf35deace728857d1d293d59eb15 (diff)
Implemented caching for certain API endpoints, Added documentation & made backend-fixes
Diffstat (limited to 'packages/server/src/types')
-rw-r--r--packages/server/src/types/fastify.d.ts11
-rw-r--r--packages/server/src/types/index.d.ts10
2 files changed, 19 insertions, 2 deletions
diff --git a/packages/server/src/types/fastify.d.ts b/packages/server/src/types/fastify.d.ts
index ebaaac2..7c2341d 100644
--- a/packages/server/src/types/fastify.d.ts
+++ b/packages/server/src/types/fastify.d.ts
@@ -1,5 +1,7 @@
import { FastifyRequest, RequestGenericInterface } from "fastify";
import { ReplyGenericInterface } from "fastify/types/reply";
+import { Settings } from ".";
+import { ServerCache } from "../cache";
export interface Request extends RequestGenericInterface {
Params: Record<string, string>,
@@ -8,4 +10,11 @@ export interface Request extends RequestGenericInterface {
export interface Route extends Request, ReplyGenericInterface {}
-export type CoolFastifyRequest = FastifyRequest<Route>; \ No newline at end of file
+export type CoolFastifyRequest = FastifyRequest<Route>;
+
+export type FastifyPluginOptions = {
+ config: {
+ settings: Settings,
+ cache: ServerCache | null
+ }
+} \ No newline at end of file
diff --git a/packages/server/src/types/index.d.ts b/packages/server/src/types/index.d.ts
index 8f592f9..ca0743d 100644
--- a/packages/server/src/types/index.d.ts
+++ b/packages/server/src/types/index.d.ts
@@ -1,10 +1,18 @@
+export type CacheConfig = {
+ enabled: boolean,
+ ttl?: number,
+ max?: number,
+ refreshThreshold?: number
+}
+
export type Settings = {
host: string,
port: number,
title: string,
about: string,
git_dir: string,
- dev: {
+ cache?: CacheConfig,
+ dev?: {
port: number
}
} \ No newline at end of file