Reflet:用装饰器简化你的 Node.js 代码

Reflet 是一套基于类型系统的模块,用于优化 Node.js 项目和现有库。它简单易用且灵活,可以帮助你轻松组织应用程序,避免冗长的代码陷阱。 值得一提的是,Reflet 在法语中是“反思”的意思,就像它鼓励开发者在编写代码之前进行思考一样。

Reflet 可以帮助你整理应用程序,并在编写代码之前进行思考。以下是如何使用它的示例:

@Use(isAuthenticated)
@Router('/things')
class ThingController {
  @Get('/:id')
  async get(@Params('id') id: string, @Res res: Response) {
    const thing = await db.collection('things').find({ id });
    res.status(200).send(thing);
  }

  @Send({ status: 201 })
  @UseGuards((req) => canCreateThing(req.user))
  async create(@Body() createThingDto: CreateThingDto) {
    // ... 创建逻辑
  }
}
folder
reflet:Node的Well修饰器 预估大小:121个文件
file
.gitignore 544B
file
.huskyrc.js 521B
file
package.json 1KB
file
coverage-summary.json 4KB
file
package.json 1KB
file
tslint.json 1KB
file
package.json 1024B
file
coverage-summary.json 1KB
file
retrieve-enums.js 1KB
file
jest.config.js 622B
file
tsconfig.json 2KB
file
package.json 1KB
file
coverage-summary.json 3KB
file
package.json 1KB
file
coverage-summary.json 4KB
file
jest.config.js 893B
file
jest-mongodb-config.js 170B
file
.commitlintrc.js 2KB
file
package.json 584B
file
.gitattributes 212B
zip 文件大小:288.67KB