【发布时间】:2016-11-23 13:08:46
【问题描述】:
我的 Nodejs 服务器将收到以下帖子请求:
POST /v1/devices/deviceID/registrations/typeID/serial#
其中 deviceID,typeID,serial# 是变量,不一样
我确实使用以下内容来确定这些变量是什么,但这不是我正在寻找的最佳解决方案,因为还有其他请求具有相同的开头,例如 /v1/devices/registrations/
app.post("/v1/devices/*", function (req, res) {
});
所以主要问题是我如何确定当您收到具有以下结构 /v1/devices/deviceID/registrations/typeID/serial# 的发布请求时,存储 DeviceID 、 typeID 和 serial# 的值
我怎样才能对这两个请求做同样的事情,还要注意设备和类型 ID 是变量
if the following is requested
GET /v1/devices/<deviceID>/registrations/<typeID>
do something
else if
GET /v1/devices/<deviceID>/registrations/<typeID>?passesUpdatedSince=<tag>
do something else
【问题讨论】:
标签: node.js request httprequest