Comments (5)
是的, 这是我之前挖的一个坑 T_T
做的时候就知道可能有 bug, 不过当时由于没有使用 before
这个 api, 所以就没有去测试它.
0.7 版中将解决这个问题. (预计本周完成) 目前请暂时使用 after.
另外, 设计 before
主要是为了进行一些验证, 如果不符合规则等, 在最后 return false
将阻止相应的操作执行. after
主要是为了可能在插入数据之后还有一些后续操作. 比如要重新计算其他 resource
的某个字段, 或可能要做一些 log. 因为 before
会阻塞整个请求, 所以建议如果只是记录 log 的话在 after
中进行, 因为它是异步的, 当 REST 的操作完成后将直接返回给客户端, 剩下的操作将在返回后执行.
这一点没有在文档中进行说明, 表示抱歉. 之后我会添加到文档中.
感谢关注.
from node-odata.
Fixed it on 969ab5d.
from node-odata.
我的实际意图是要记录 每次操作的服务器处理耗时。
设计在before中放入开始时间,在after中用(当前时间-开始时间)计算出方法的总耗时,是否可行?
或者有其他更好的记录方式吗
from node-odata.
可以考虑使用 response-time 中间件.
from node-odata.
谢谢,已经搞定
from node-odata.
Related Issues (20)
- Accept header
- Service document
- $select query option by get by id
- Deep objects and dot as property name
- How to use this with existing express instance? HOT 1
- Async Auth support HOT 1
- Skipping saving to db inside the post/put().before HOT 7
- asynchronous calls inside the post/put().before HOT 2
- A better way to declare a resource. HOT 3
- How do i get _id property? HOT 1
- Can I host on SSL? HOT 1
- Generate service according edmx/metadata HOT 1
- JSON Patch support for partial updates on resource HOT 1
- Parenthesis are not supported in filter HOT 1
- Please show example with mongodb and how it is accessed/ queried
- Critical and high vulnerability from npm audit
- Metadata Endpoint
- Node version corresponding package-lock.json
- some tests fails each run, but each time different test
- $format query option
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 node-odata.