mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
14 lines
347 B
TypeScript
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;
|