拆分一个json对象然后它返回未定义

时间:2015-12-18 14:44:57

标签: javascript json node.js

我正在尝试拆分json对象。对象正在通过我的api。但是,当我尝试打破对象时,我得到undefined

对象:

Object {_id: "248mehw32ako48wuwvobf66fvoevb2p", auth: "YWRtaW46cGFzc3dvcmQ="}

js code

server.del('/inter/delete', (req, res) => {
    //From the URL both the auth and listID is extrcted
    console.log('body test')
    console.log(req.body)
    console.log('id te')

    const listID = req.body._id
    console.log(req.body.auth)
    const auth = req.body.auth

    inter.deleWeather(auth, listID, (data) => {
        res.setHeader('content-type', 'application/json')
        res.send(data.code, {status: data.status, message: 'this should delete the specified resource'})
        res.end()
    })
})

0 个答案:

没有答案