diff options
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 |