Can not get parameter from req.body with POST request in Azure NodeJS AppService

繁伸 松尾 51 Reputation points


My Windows Azure NodeJS AppService can not get parameter from req.body. I am using Express 4.17 with body-parser. Every time I post a request with body data (example: {"uid":"12345"}) with server-side code'/abc', function (req, res) {
var uid = req.body.uid;

This code worked normally on local but in Windows Azure NodeJS AppService, uid is always Undefined or Null
How can I fix this problem ? Thank you very much.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,212 questions
{count} votes

Accepted answer
  1. Ryan Hill 26,856 Reputation points Microsoft Employee

    Hi @繁伸 松尾 ,

    Since your code is server side, have you tried remote debugging your application? I did come across, which contains an example of using body-parser. I've confirmed this does indeed work on a Windows hosted App Service running NodeJS 12LTS.


    I used the following code.

    var express = require('express');  
    var bodyParser = require('body-parser')  
    var router = express.Router();  
    var jsonParser = bodyParser.json();  
    /* GET users listing. */  
    router.get('/', function(req, res, next) {  
      res.send('respond with a resource');  
 '/one', jsonParser, function(req, res){  
    module.exports = router;  


0 additional answers

Sort by: Most helpful