diff options
author | HampusM <hampus@hampusmat.com> | 2021-08-18 17:29:55 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-08-18 17:29:55 +0200 |
commit | d1a1b7dc947063aef5f8375a6a1e03246b272c84 (patch) | |
tree | f5cb9bd6d4b5463d9d022026ac6fea87cb6ebe02 /packages/server/src/routes/repo.ts | |
parent | 6ed078de30a7bf35deace728857d1d293d59eb15 (diff) |
Implemented caching for certain API endpoints, Added documentation & made backend-fixes
Diffstat (limited to 'packages/server/src/routes/repo.ts')
-rw-r--r-- | packages/server/src/routes/repo.ts | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/packages/server/src/routes/repo.ts b/packages/server/src/routes/repo.ts index bb70c68..1088e6b 100644 --- a/packages/server/src/routes/repo.ts +++ b/packages/server/src/routes/repo.ts @@ -1,11 +1,11 @@ import { Repository } from "../git/repository"; -import { CoolFastifyRequest, Route } from "../types/fastify"; +import { CoolFastifyRequest, Route, FastifyPluginOptions } from "../types/fastify"; import { Tag } from "../git/tag"; -import { FastifyInstance, FastifyPluginOptions } from "fastify"; +import { FastifyPluginCallback } from "fastify"; import { verifyRepoName } from "../routes/api/util"; import { ServerError } from "../git/error"; -export default function(fastify: FastifyInstance, opts: FastifyPluginOptions, done: (err?: Error) => void): void { +const repo: FastifyPluginCallback<FastifyPluginOptions> = (fastify, opts, done): void => { fastify.addHook("onRequest", async(req: CoolFastifyRequest, reply) => { if(!verifyRepoName(req.params.repo)) { reply.code(400).send("Bad request"); @@ -86,4 +86,6 @@ export default function(fastify: FastifyInstance, opts: FastifyPluginOptions, do }); done(); -}
\ No newline at end of file +}; + +export default repo;
\ No newline at end of file |