Files
directus/api/src/middleware/use-collection.ts
2020-07-29 11:22:56 -04:00

14 lines
347 B
TypeScript

/**
* Set req.collection for use in other middleware. Used as an alternative on validate-collection for
* system collections
*/
import asyncHandler from 'express-async-handler';
const useCollection = (collection: string) =>
asyncHandler(async (req, res, next) => {
req.collection = collection;
next();
});
export default useCollection;