Comments (7)
由于临近双十一,太忙了,此次暂时不讨论,待会直接上文章。
from weekly.
双十一还早吧。。。
from weekly.
你好,在知乎和掘金看到了这篇文章,文章里讲到了nestjs
里参数验证的部分,其中“对于不同的请求做不同的校样”,请问有没有例子可供参考?
我目前是根据官方文档用了pipe
, 但是这样会导致默认全部校验,望指点,感激不尽。
from weekly.
是对 “不同实体” 做不同校验,方式是给实体添加装饰器来完成:
@Column({
comment: '配置 JSON',
length: 5000,
})
@Validator.IsString({ message: '必须为字符串' })
@Validator.Length(0, 5000, { message: '长度在 0~5000' })
content: string;
from weekly.
@ascoders 谢谢,如果方便请移步这里:segmentfault,有详细的描述。
我想请教的是,一个实体,定义的时候会声明校验规则(如你上面所写),在请求的时候可以通过pipe
来进行参数验证,可是这个验证默认是 全部验证 ,即所有字段需要符合实体类里定义的规则,可是如你那篇文章里所说一样,有些请求不需要验证所有字段(例如删除和修改),此时具体应该怎样实现?
我根据你所写的 EverythingSubscriber
并不能实现(技术比较渣),请问能否给个demo,或者伪代码,真心感谢~!
from weekly.
上传文件FileInterceptor里MulterOptions的storage要怎么创建啊,有没有像multer中的diskStorage,在哪里导入,有人知道吗
from weekly.
不是很能理解数据库跑在docker里的操作,不方便持久化处理,而且docker-compose会把项目和数据库混在一起。
from weekly.
Related Issues (20)
- 可视化搭建 - 场景实战
- 加班中,请假一次 HOT 1
- 【自荐开源】AI可视化SolidUI HOT 2
- 精读《自由 + 磁贴混合布局》
- 请假一次 🏳️
- 精读《自由布局吸附线的实现》
- 请假一次 HOT 1
- 精读《算法题 - 通配符匹配》
- 这里我想是对应的 '*' 不匹配任何字符? HOT 1
- 精读《算法题 - 统计可以被 K 整除的下标对数目》
- 精读《算法题 - 最小覆盖子串》
- 请假一次
- 精读《算法题 - 地下城游戏》
- 请假一次 HOT 6
- 精读《VisActor 数据可视化工具》
- 精读《算法题 - 编辑距离》
- 请假一次
- 精读《算法题 - 二叉树中的最大路径和》
- 休刊一段时间 HOT 8
- 真的牛逼,竟然检测有病毒
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from weekly.