variable name contains dash creates problems for req.query for NodeJS Express?

https://stackoverflow.com/questions/22740821/get-variable-name-contains-dash-creates-problems-for-req-query-for-nodejs-expres

In javascript, object values can be accessed by using either . or []
When the key contains a dash, you cannot use the . notation because the - will be interpreted as "minus". This is not related to express, it's just how javascript works.
So you should use:
req.query["message-timestamp"]

Không có nhận xét nào:

Is it okay to use both fetchpriority="high" and loading="eager" in img tag?

 https://stackoverflow.com/questions/77744344/is-it-okay-to-use-both-fetchpriority-high-and-loading-eager-in-img-tag Yes Fetchpriority and l...