typenexus
Version:
TypeNexus is a good tool for API encapsulation and management. It provides a clean and lightweight way to package TypeORM functionality, helping you build applications faster while reducing template code redundancy and type conversion work.
44 lines (43 loc) • 1.34 kB
JavaScript
import { getFromContainer } from './ControllerMetadata.js';
/**
* Middleware metadata.
*/
export class MiddlewareMetadata {
// -------------------------------------------------------------------------
// Properties
// -------------------------------------------------------------------------
/**
* Indicates if this middleware is global, thous applied to all routes.
*/
global;
/**
* Object class of the middleware class.
*/
target;
/**
* Execution priority of the middleware.
*/
priority;
/**
* Indicates if middleware must be executed after routing action is executed.
*/
type;
// -------------------------------------------------------------------------
// Constructor
// -------------------------------------------------------------------------
constructor(args) {
this.global = args.global;
this.target = args.target;
this.priority = args.priority;
this.type = args.type;
}
// -------------------------------------------------------------------------
// Accessors
// -------------------------------------------------------------------------
/**
* Gets middleware instance from the container.
*/
get instance() {
return getFromContainer(this.target);
}
}