From d1a1b7dc947063aef5f8375a6a1e03246b272c84 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 18 Aug 2021 17:29:55 +0200 Subject: Implemented caching for certain API endpoints, Added documentation & made backend-fixes --- packages/server/src/types/fastify.d.ts | 11 ++++++++++- packages/server/src/types/index.d.ts | 10 +++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'packages/server/src/types') 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, @@ -8,4 +10,11 @@ export interface Request extends RequestGenericInterface { export interface Route extends Request, ReplyGenericInterface {} -export type CoolFastifyRequest = FastifyRequest; \ No newline at end of file +export type CoolFastifyRequest = FastifyRequest; + +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 -- cgit v1.2.3-18-g5258