Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ojhaujjwal/a8de8b0967a0fa14b05f88ce36b46bcc to your computer and use it in GitHub Desktop.
Save ojhaujjwal/a8de8b0967a0fa14b05f88ce36b46bcc to your computer and use it in GitHub Desktop.
import { Controller, ControllerOptions } from '@nestjs/common';
import { join } from 'path';
import { AuthenticationGuard, AccessControlGuard } from 'app/guards';
expose function AdminController(options: ControllerOptions) {
return function (target: Function) {
Controller(join('/admin', options.path))(target);
AuthenticationGuard()(target);
AccessControlGuard({ role: 'admin' })(target);
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment