我正在运行一个 coap 服务器,当我开始添加路由时,维护我自己的路由有点乏味,所以我想我会切换到 express(我已经将它用于 http 服务器)。
现在,鉴于它使用基本相同的格式server.on("request", (req, res) => {...})
,我认为它会兼容,但 express 添加了各种不在 coap 规范中的标头。
我想要做的只是为我的 coap 应用程序使用快速路由的便利。这可能吗?我目前正在这样做:
const server = coap.createServer(...);
const app = express();
server.on("request", app);
我最终得到的是这个错误:
Uncaught Error: Unknown string to Buffer converter for option: X-Content-Type-Options
at module.exports.toBinary (node_modules/coap/lib/option_converter.js:21:11)
at OutMessage.setOption (node_modules/coap/lib/helpers.js:56:16)
at Immediate.write (node_modules/finalhandler/index.js:164:9)