I'm running a coap server, and as I've started adding routes, maintaining my own routing is a bit tedious so I thought I'd switch to express (which I already use for an http server).
Now, given that it uses basically the same format for server.on("request", (req, res) => {...})
, I assumed it would be compatible, but express adds various headers that aren't in the coap spec.
What I want to be able to do is just use the convenience of express routing for my coap app. Is this possible? I'm currently doing this:
const server = coap.createServer(...);
const app = express();
server.on("request", app);
What I end up with is this error:
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)