Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nestrx/access-control

Module Access control for NestJS
https://github.com/nestrx/access-control

access-control nestjs rbac

Last synced: 7 days ago
JSON representation

Module Access control for NestJS

Awesome Lists containing this project

README

        

# ACCESS CONTROL
The module encryption AES GCM for [NestJS framework](https://nestjs.com/).

## Installation

npm:
```bash
npm i @nestrx/access-control
```
yan
```bash
yan add @nestrx/access-control
```

## Configure

app.module.ts
```ts
...
@Module({
...
imports: [
...
AccessControlModule,
...
],
...
})
...
```

## Usage

your.controller.ts

```ts
...
@Controller('route')
export class YourController{

@Get()
@Role() // default user role
action(@Query() query: any): string{
// todo something
}
@Post()
@Role('admin')
adminAccess(@Body() data: any, @User('id') accessBy: string): string{
// todo something
}
}
...
```