Skip to content

Commit

Permalink
Encapsulate routes in separate plugins
Browse files Browse the repository at this point in the history
So that changes to the Fastify instance will only be reflected in each plugin's scope.
  • Loading branch information
thebengeu committed Jul 13, 2021
1 parent f6bcd2c commit 00708b9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions src/routes/bucket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import updateBucket from './updateBucket'

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export default async function routes(fastify: FastifyInstance) {
createBucket(fastify)
deleteBucket(fastify)
emptyBucket(fastify)
getAllBuckets(fastify)
getBucket(fastify)
updateBucket(fastify)
fastify.register(createBucket)
fastify.register(deleteBucket)
fastify.register(emptyBucket)
fastify.register(getAllBuckets)
fastify.register(getBucket)
fastify.register(updateBucket)
}
22 changes: 11 additions & 11 deletions src/routes/object/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ import updateObject from './updateObject'

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export default async function routes(fastify: FastifyInstance) {
copyObject(fastify)
createObject(fastify)
deleteObject(fastify)
deleteObjects(fastify)
getObject(fastify)
getSignedObject(fastify)
getPublicObject(fastify)
getSignedURL(fastify)
moveObject(fastify)
updateObject(fastify)
listObjects(fastify)
fastify.register(copyObject)
fastify.register(createObject)
fastify.register(deleteObject)
fastify.register(deleteObjects)
fastify.register(getObject)
fastify.register(getSignedObject)
fastify.register(getPublicObject)
fastify.register(getSignedURL)
fastify.register(moveObject)
fastify.register(updateObject)
fastify.register(listObjects)
}

0 comments on commit 00708b9

Please # to comment.