how to fix [Object: null prototype] { title: 'product' }

后端 未结 8 484
醉话见心
醉话见心 2020-12-15 05:02

I\'ve started learning node.js with express framework , when I post a form like this :

rout         


        
相关标签:
8条回答
  • 2020-12-15 05:53

    This is a built-in middleware function in Express. It parses incoming requests with JSON payloads and is based on body-parser.

    Returns middleware that only parses JSON and only looks at requests where the Content-Type header matches the type option. This parser accepts any Unicode encoding of the body and supports automatic inflation of gzip and deflate encodings.

    A new body object containing the parsed data is populated on the request object after the middleware (i.e. req.body), or an empty object ({}) if there was no body to parse, the Content-Type was not matched, or an error occurred. app.use( express.urlencoded({ extended: true }) );

    0 讨论(0)
  • 2020-12-15 05:54

    You can try this:

    app.use(express.urlencoded({ extended: false }));
    
    0 讨论(0)
提交回复
热议问题