【发布时间】:2017-04-05 04:05:21
【问题描述】:
我正在尝试使用node.js、express4 和body-parser 创建一个演示 API 服务器。我正在尝试使用一些Api-Key 来保护它,这些Api-Key 必须在请求标头中传递。但是,我做不到。
我试过了
console.log(bodyParser.getheader("Api-Key"))
和
console.log(app.getheader("Api-Key"))
但在这两种情况下我都会收到错误
getheader is not a function
那么现在我可以使用正文解析器读取标题了吗?
【问题讨论】:
标签: node.js http-headers body-parser get-headers