开发者

custom bodyDecoder for Express in node.js server

I'm trying to figure out how to override the Express.bodyDecoder to return what I want it to return in a way that doesn't require modifying the Express开发者_如何学Python definition. I feel like I could implement it right now but I don't know the "right way". Help?


You can copy the Connect bodyParser (which is passed up through Express) and modify it to taste, then call your modified version rather than express's in your app configuration. Example:

var express = require('express'),
    myBodyParser = require('myBodyParser');

var app = express.createServer(
    myBodyParser()
);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜