jurisv / nodejs.extdirect

Ext.Direct connector for node.js (npm module)
41 stars 16 forks source link

Cannot read property 'extAction' of undefined #28

Closed zanzara closed 9 years ago

zanzara commented 9 years ago

Why does I get such an error message from node.js server? It is generated in router.js line 43 . that means that so = d[i]; is undefined above.

In my direct POST the parameters are all set i.e.: {"action":"DXFormTest","method":"testMe","data":[{"username":"fdgf","password":"fdgfd"}],"type":"rpc","tid":1}

Appreciating any hints.

shivamgoel commented 9 years ago

What express version are you using ??

zanzara commented 9 years ago

Hi I'm using express@3.1.0

zanzara commented 9 years ago

req.body in function processRoute() from router.js does not exit

jurisv commented 9 years ago

"dependencies": { "express": "3.1.0", .. }

jurisv commented 9 years ago

Also , please take a look at the server examples : https://github.com/jurisv/extdirect.examples/tree/master/node-server

zanzara commented 9 years ago

Thanks. I did the server side like in the examples. For more details this is the complete server error message I get:

TypeError: Cannot read property 'extAction' of undefined at Object.route.processRoute (/volume1/web/node-server/extdirect-mysql/node_modules/extdirect/lib/router.js:43:19) at app.configure.app.use.express.errorHandler.dumpExceptions (/volume1/web/node-server/extdirect-mysql/server.js:92:15) at callbacks (/volume1/web/node-server/extdirect-mysql/node_modules/express/lib/router/index.js:161:37) at param (/volume1/web/node-server/extdirect-mysql/node_modules/express/lib/router/index.js:135:11) at pass (/volume1/web/node-server/extdirect-mysql/node_modules/express/lib/router/index.js:142:5) at Router._dispatch (/volume1/web/node-server/extdirect-mysql/node_modules/express/lib/router/index.js:170:5) at Object.router (/volume1/web/node-server/extdirect-mysql/node_modules/express/lib/router/index.js:33:10) at next (/volume1/web/node-server/extdirect-mysql/node_modules/express/node_modules/connect/lib/proto.js:199:15) at Object.handle (/volume1/web/node-server/extdirect-mysql/server.js:67:13) at next (/volume1/web/node-server/extdirect-mysql/node_modules/express/node_modules/connect/lib/proto.js:199:15)

zanzara commented 9 years ago

In my opinion , the problem starts here in server.js:

// POST request process route and calls class app.post(ExtDirectConfig.classPath, function(request, response) { extdirect.processRoute(request, response, ExtDirectConfig); });

'request' has a lots of data, but no 'body' element, which is used in router.js processRoute() 'var data = req.body ,....' So therefore all following vars in that routine are undefined!
"so.extAction" is only the first one where it crashs.

Btw. I can post 'req' but it's maybe too much here (apporx 740 lines)

jurisv commented 9 years ago

Can't reproduce.

Configuration 1: Node server version 0.10.33 Using express 3.1.0, extdirect 1.3.6, mysql 2.0.0-rc2 nconf 0.6.9

Configuration 2: Node server version 0.12.0 Using express 3.1.0, extdirect 1.3.6, mysql 2.0.1 nconf 0.6.9

Sencha CMD 5.1.2.52 , Ext JS 5.0.1.1255 / Ext JS 5.1.0.107

zanzara commented 9 years ago

Hi I'm using almost the same configuration: Node server version 0.12.0 (also 0.10.31) Using express 3.1.0, extdirect 1.3.6, mysql 2.0.1 nconf 0.6.9

Sencha Cmd v5.1.1.39 , Ext JS 5.1.0.107

could you maybe please post what's in your
'var data = req.body ,....' form processRoute()?

I really can't understand, whre my problem lies. Is it maybe a problem where I call "ExtRemote.DXLogin.*" functions in the ExtJS project?

zanzara commented 9 years ago

Still appreciating any hints. This topic is really annoying. I tried several more things, but /wo success. The problem lies here in server.js imo:

// POST request process route and calls class app.post(ExtDirectConfig.classPath, function(request, response) { extdirect.processRoute(request, response, ExtDirectConfig); });

where 'request' got NO body tag, as processRouter() expects.

jurisv commented 9 years ago

Yes, the request body should contain object with something like this:

body: 
   [ { action: 'DXTree',
       method: 'getTree',
       data: [Object],
       type: 'rpc',
       tid: 1 },
     { action: 'DXTodoItem',
       method: 'read',
       data: [Object],
       type: 'rpc',
       tid: 2 } ],
jurisv commented 9 years ago

call Can You please post what do you see in network call when running ExtJs5 example? Also what is your output when you are getting API descriptor ( http://localhost:3000/directapi ) Example should look like this:

Ext.ns("ExtRemote");ExtRemote.REMOTING_API={"url":"http://localhost:3000/direct","namespace":"ExtRemote","type":"remoting","actions":{"DXFormTest":[{"name":"testMe","len":1},{"name":"testException","len":1},{"name":"load","len":1},{"name":"submit","len":1,"formHandler":true},{"name":"filesubmit","len":1,"formHandler":true}],"DXLogin":[{"name":"authenticate","len":1}],"DXTask":[{"name":"create","len":1},{"name":"read","len":1},{"name":"update","len":1},{"name":"destroy","len":1}],"DXTodoItem":[{"name":"create","len":1},{"name":"read","len":1},{"name":"update","len":1},{"name":"destroy","len":1}],"DXTree":[{"name":"getTree","len":1}]}}
zanzara commented 9 years ago

Thanks for your response. In the first call, I got the answer (the API descriptor) nodejs2

It's the same as yours above.

Aterwards, OPTIONS are calling but answer is empty.

nodejs1

Then calling an API function, I got not your body tag. The http-answer is the nodejs-server error message 'extAction' undefined.

Looking at the post request process route, i get something like this:

// POST request process route and calls class
app.post(ExtDirectConfig.classPath, function(request, response) {
    console.log(request);    //  <-----------
    extdirect.processRoute(request, response, ExtDirectConfig);
});

request is this:

{ _readableState:
   { highWaterMark: 16384,
     buffer: [],
     length: 0,
     pipes: null,
     pipesCount: 0,
     flowing: false,
     ended: false,
     endEmitted: false,
     reading: false,
     calledRead: false,
     sync: true,
     needReadable: false,
     emittedReadable: false,
     readableListening: false,
     objectMode: false,
     defaultEncoding: 'utf8',
     ranOut: false,
     awaitDrain: 0,
     readingMore: false,
     decoder: null,
     encoding: null },
  readable: true,
  domain: null,
  _events: {},
  _maxListeners: 10,
  socket:
   { _connecting: false,
     _handle:
      { fd: 13,
        writeQueueSize: 0,
        owner: [Circular],
        onread: [Function: onread],
        reading: true },
     _readableState:
      { highWaterMark: 16384,
        buffer: [],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: false,
        ended: false,
        endEmitted: false,
        reading: true,
        calledRead: true,
        sync: false,
        needReadable: true,
        emittedReadable: false,
        readableListening: false,
        objectMode: false,
        defaultEncoding: 'utf8',
        ranOut: false,
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: true,
     domain: null,
     _events:
      { end: [Object],
        finish: [Function: onSocketFinish],
        _socketEnd: [Function: onSocketEnd],
        drain: [Object],
        timeout: [Function],
        error: [Function],
        close: [Object] },
     _maxListeners: 10,
     _writableState:
      { highWaterMark: 16384,
        objectMode: false,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        decodeStrings: false,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        sync: true,
        bufferProcessing: false,
        onwrite: [Function],
        writecb: null,
        writelen: 0,
        buffer: [],
        errorEmitted: false },
     writable: true,
     allowHalfOpen: true,
     onend: [Function],
     destroyed: false,
     bytesRead: 618,
     _bytesDispatched: 0,
     _pendingData: null,
     _pendingEncoding: '',
     server:
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        _connections: 2,
        connections: [Getter/Setter],
        _handle: [Object],
        _usingSlaves: false,
        _slaves: [],
        allowHalfOpen: true,
        httpAllowHalfOpen: false,
        timeout: 120000,
        _connectionKey: '4:0.0.0.0:3000' },
     _idleTimeout: 120000,
     _idleNext:
      { _connecting: false,
        _handle: [Object],
        _readableState: [Object],
        readable: true,
        domain: null,
        _events: [Object],
        _maxListeners: 10,
        _writableState: [Object],
        writable: true,
        allowHalfOpen: true,
        onend: [Function],
        destroyed: false,
        bytesRead: 393,
        _bytesDispatched: 1197,
        _pendingData: null,
        _pendingEncoding: '',
        server: [Object],
        _idleTimeout: 120000,
        _idleNext: [Object],
        _idlePrev: [Circular],
        _idleStart: 1428494395240,
        _monotonicStartTime: 15575747,
        parser: [Object],
        ondata: [Function],
        _paused: false,
        _httpMessage: null },
     _idlePrev: { _idleNext: [Circular], _idlePrev: [Object] },
     _idleStart: 1428494400180,
     _monotonicStartTime: 15580688,
     parser:
      { _headers: [],
        _url: '',
        onHeaders: [Function: parserOnHeaders],
        onHeadersComplete: [Function: parserOnHeadersComplete],
        onBody: [Function: parserOnBody],
        onMessageComplete: [Function: parserOnMessageComplete],
        socket: [Circular],
        incoming: [Circular],
        maxHeaderPairs: 2000,
        onIncoming: [Function] },
     ondata: [Function],
     _paused: false,
     _httpMessage:
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        output: [],
        outputEncodings: [],
        writable: true,
        _last: false,
        chunkedEncoding: false,
        shouldKeepAlive: true,
        useChunkedEncodingByDefault: true,
        sendDate: true,
        _headerSent: false,
        _header: '',
        _hasBody: true,
        _trailer: '',
        finished: false,
        _hangupClose: false,
        socket: [Circular],
        connection: [Circular],
        app: [Object],
        _headers: [Object],
        _headerNames: [Object],
        req: [Circular],
        viewCallbacks: [],
        locals: [Function: locals],
        end: [Function],
        write: [Function] } },
  connection:
   { _connecting: false,
     _handle:
      { fd: 13,
        writeQueueSize: 0,
        owner: [Circular],
        onread: [Function: onread],
        reading: true },
     _readableState:
      { highWaterMark: 16384,
        buffer: [],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: false,
        ended: false,
        endEmitted: false,
        reading: true,
        calledRead: true,
        sync: false,
        needReadable: true,
        emittedReadable: false,
        readableListening: false,
        objectMode: false,
        defaultEncoding: 'utf8',
        ranOut: false,
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: true,
     domain: null,
     _events:
      { end: [Object],
        finish: [Function: onSocketFinish],
        _socketEnd: [Function: onSocketEnd],
        drain: [Object],
        timeout: [Function],
        error: [Function],
        close: [Object] },
     _maxListeners: 10,
     _writableState:
      { highWaterMark: 16384,
        objectMode: false,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        decodeStrings: false,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        sync: true,
        bufferProcessing: false,
        onwrite: [Function],
        writecb: null,
        writelen: 0,
        buffer: [],
        errorEmitted: false },
     writable: true,
     allowHalfOpen: true,
     onend: [Function],
     destroyed: false,
     bytesRead: 618,
     _bytesDispatched: 0,
     _pendingData: null,
     _pendingEncoding: '',
     server:
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        _connections: 2,
        connections: [Getter/Setter],
        _handle: [Object],
        _usingSlaves: false,
        _slaves: [],
        allowHalfOpen: true,
        httpAllowHalfOpen: false,
        timeout: 120000,
        _connectionKey: '4:0.0.0.0:3000' },
     _idleTimeout: 120000,
     _idleNext:
      { _connecting: false,
        _handle: [Object],
        _readableState: [Object],
        readable: true,
        domain: null,
        _events: [Object],
        _maxListeners: 10,
        _writableState: [Object],
        writable: true,
        allowHalfOpen: true,
        onend: [Function],
        destroyed: false,
        bytesRead: 393,
        _bytesDispatched: 1197,
        _pendingData: null,
        _pendingEncoding: '',
        server: [Object],
        _idleTimeout: 120000,
        _idleNext: [Object],
        _idlePrev: [Circular],
        _idleStart: 1428494395240,
        _monotonicStartTime: 15575747,
        parser: [Object],
        ondata: [Function],
        _paused: false,
        _httpMessage: null },
     _idlePrev: { _idleNext: [Circular], _idlePrev: [Object] },
     _idleStart: 1428494400180,
     _monotonicStartTime: 15580688,
     parser:
      { _headers: [],
        _url: '',
        onHeaders: [Function: parserOnHeaders],
        onHeadersComplete: [Function: parserOnHeadersComplete],
        onBody: [Function: parserOnBody],
        onMessageComplete: [Function: parserOnMessageComplete],
        socket: [Circular],
        incoming: [Circular],
        maxHeaderPairs: 2000,
        onIncoming: [Function] },
     ondata: [Function],
     _paused: false,
     _httpMessage:
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        output: [],
        outputEncodings: [],
        writable: true,
        _last: false,
        chunkedEncoding: false,
        shouldKeepAlive: true,
        useChunkedEncodingByDefault: true,
        sendDate: true,
        _headerSent: false,
        _header: '',
        _hasBody: true,
        _trailer: '',
        finished: false,
        _hangupClose: false,
        socket: [Circular],
        connection: [Circular],
        app: [Object],
        _headers: [Object],
        _headerNames: [Object],
        req: [Circular],
        viewCallbacks: [],
        locals: [Function: locals],
        end: [Function],
        write: [Function] } },
  httpVersion: '1.1',
  complete: false,
  headers:
   { host: '10.0.2.60:3000',
     'user-agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0',
     accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
     'accept-language': 'de,en-US;q=0.7,en;q=0.3',
     'accept-encoding': 'gzip, deflate',
     'content-type': 'application/json; charset=UTF-8',
     'x-requested-with': 'XMLHttpRequest',
     referer: 'http://10.0.2.60/trem/',
     'content-length': '110',
     origin: 'http://10.0.2.60',
     connection: 'keep-alive',
     pragma: 'no-cache',
     'cache-control': 'no-cache' },
  trailers: {},
  _pendings: [],
  _pendingIndex: 0,
  url: '/direct',
  method: 'POST',
  statusCode: null,
  client:
   { _connecting: false,
     _handle:
      { fd: 13,
        writeQueueSize: 0,
        owner: [Circular],
        onread: [Function: onread],
        reading: true },
     _readableState:
      { highWaterMark: 16384,
        buffer: [],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: false,
        ended: false,
        endEmitted: false,
        reading: true,
        calledRead: true,
        sync: false,
        needReadable: true,
        emittedReadable: false,
        readableListening: false,
        objectMode: false,
        defaultEncoding: 'utf8',
        ranOut: false,
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: true,
     domain: null,
     _events:
      { end: [Object],
        finish: [Function: onSocketFinish],
        _socketEnd: [Function: onSocketEnd],
        drain: [Object],
        timeout: [Function],
        error: [Function],
        close: [Object] },
     _maxListeners: 10,
     _writableState:
      { highWaterMark: 16384,
        objectMode: false,
        needDrain: false,
        ending: false,
        ended: false,
        finished: false,
        decodeStrings: false,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        sync: true,
        bufferProcessing: false,
        onwrite: [Function],
        writecb: null,
        writelen: 0,
        buffer: [],
        errorEmitted: false },
     writable: true,
     allowHalfOpen: true,
     onend: [Function],
     destroyed: false,
     bytesRead: 618,
     _bytesDispatched: 0,
     _pendingData: null,
     _pendingEncoding: '',
     server:
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        _connections: 2,
        connections: [Getter/Setter],
        _handle: [Object],
        _usingSlaves: false,
        _slaves: [],
        allowHalfOpen: true,
        httpAllowHalfOpen: false,
        timeout: 120000,
        _connectionKey: '4:0.0.0.0:3000' },
     _idleTimeout: 120000,
     _idleNext:
      { _connecting: false,
        _handle: [Object],
        _readableState: [Object],
        readable: true,
        domain: null,
        _events: [Object],
        _maxListeners: 10,
        _writableState: [Object],
        writable: true,
        allowHalfOpen: true,
        onend: [Function],
        destroyed: false,
        bytesRead: 393,
        _bytesDispatched: 1197,
        _pendingData: null,
        _pendingEncoding: '',
        server: [Object],
        _idleTimeout: 120000,
        _idleNext: [Object],
        _idlePrev: [Circular],
        _idleStart: 1428494395240,
        _monotonicStartTime: 15575747,
        parser: [Object],
        ondata: [Function],
        _paused: false,
        _httpMessage: null },
     _idlePrev: { _idleNext: [Circular], _idlePrev: [Object] },
     _idleStart: 1428494400180,
     _monotonicStartTime: 15580688,
     parser:
      { _headers: [],
        _url: '',
        onHeaders: [Function: parserOnHeaders],
        onHeadersComplete: [Function: parserOnHeadersComplete],
        onBody: [Function: parserOnBody],
        onMessageComplete: [Function: parserOnMessageComplete],
        socket: [Circular],
        incoming: [Circular],
        maxHeaderPairs: 2000,
        onIncoming: [Function] },
     ondata: [Function],
     _paused: false,
     _httpMessage:
      { domain: null,
        _events: [Object],
        _maxListeners: 10,
        output: [],
        outputEncodings: [],
        writable: true,
        _last: false,
        chunkedEncoding: false,
        shouldKeepAlive: true,
        useChunkedEncodingByDefault: true,
        sendDate: true,
        _headerSent: false,
        _header: '',
        _hasBody: true,
        _trailer: '',
        finished: false,
        _hangupClose: false,
        socket: [Circular],
        connection: [Circular],
        app: [Object],
        _headers: [Object],
        _headerNames: [Object],
        req: [Circular],
        viewCallbacks: [],
        locals: [Function: locals],
        end: [Function],
        write: [Function] } },
  _consuming: false,
  _dumped: false,
  httpVersionMajor: 1,
  httpVersionMinor: 1,
  upgrade: false,
  originalUrl: '/direct',
  _parsedUrl:
   { protocol: null,
     slashes: null,
     auth: null,
     host: null,
     port: null,
     hostname: null,
     hash: null,
     search: null,
     query: null,
     pathname: '/direct',
     path: '/direct',
     href: '/direct' },
  query: {},
  app:
   { [Function: app]
     use: [Function],
     handle: [Function],
     listen: [Function],
     setMaxListeners: [Function: setMaxListeners],
     emit: [Function: emit],
     addListener: [Function: addListener],
     on: [Function: addListener],
     once: [Function: once],
     removeListener: [Function: removeListener],
     removeAllListeners: [Function: removeAllListeners],
     listeners: [Function: listeners],
     route: '/',
     stack:
      [ [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object],
        [Object] ],
     init: [Function],
     defaultConfiguration: [Function],
     engine: [Function],
     param: [Function],
     set: [Function],
     path: [Function],
     enabled: [Function],
     disabled: [Function],
     enable: [Function],
     disable: [Function],
     configure: [Function],
     get: [Function],
     post: [Function],
     put: [Function],
     head: [Function],
     delete: [Function],
     options: [Function],
     trace: [Function],
     copy: [Function],
     lock: [Function],
     mkcol: [Function],
     move: [Function],
     propfind: [Function],
     proppatch: [Function],
     unlock: [Function],
     report: [Function],
     mkactivity: [Function],
     checkout: [Function],
     merge: [Function],
     'm-search': [Function],
     notify: [Function],
     subscribe: [Function],
     unsubscribe: [Function],
     patch: [Function],
     all: [Function],
     del: [Function],
     render: [Function],
     request: {},
     response: {},
     cache: {},
     settings:
      { 'x-powered-by': true,
        env: 'development',
        'subdomain offset': 2,
        views: '/volume1/web/nodejsBackEnd/extdirect-mysql/views',
        'jsonp callback name': 'callback',
        'json spaces': 2,
        port: 3000 },
     engines: {},
     viewCallbacks: [],
     _events: { mount: [Function] },
     _router:
      { map: [Object],
        params: {},
        _params: [],
        caseSensitive: false,
        strict: false,
        middleware: [Function: router] },
     routes: { get: [Object], post: [Object] },
     router: [Getter],
     locals: { [Function: locals] settings: [Object] },
     _usedRouter: true },
  res:
   { domain: null,
     _events: { finish: [Function], header: [Object] },
     _maxListeners: 10,
     output: [],
     outputEncodings: [],
     writable: true,
     _last: false,
     chunkedEncoding: false,
     shouldKeepAlive: true,
     useChunkedEncodingByDefault: true,
     sendDate: true,
     _headerSent: false,
     _header: '',
     _hasBody: true,
     _trailer: '',
     finished: false,
     _hangupClose: false,
     socket:
      { _connecting: false,
        _handle: [Object],
        _readableState: [Object],
        readable: true,
        domain: null,
        _events: [Object],
        _maxListeners: 10,
        _writableState: [Object],
        writable: true,
        allowHalfOpen: true,
        onend: [Function],
        destroyed: false,
        bytesRead: 618,
        _bytesDispatched: 0,
        _pendingData: null,
        _pendingEncoding: '',
        server: [Object],
        _idleTimeout: 120000,
        _idleNext: [Object],
        _idlePrev: [Object],
        _idleStart: 1428494400180,
        _monotonicStartTime: 15580688,
        parser: [Object],
        ondata: [Function],
        _paused: false,
        _httpMessage: [Circular] },
     connection:
      { _connecting: false,
        _handle: [Object],
        _readableState: [Object],
        readable: true,
        domain: null,
        _events: [Object],
        _maxListeners: 10,
        _writableState: [Object],
        writable: true,
        allowHalfOpen: true,
        onend: [Function],
        destroyed: false,
        bytesRead: 618,
        _bytesDispatched: 0,
        _pendingData: null,
        _pendingEncoding: '',
        server: [Object],
        _idleTimeout: 120000,
        _idleNext: [Object],
        _idlePrev: [Object],
        _idleStart: 1428494400180,
        _monotonicStartTime: 15580688,
        parser: [Object],
        ondata: [Function],
        _paused: false,
        _httpMessage: [Circular] },
     app:
      { [Function: app]
        use: [Function],
        handle: [Function],
        listen: [Function],
        setMaxListeners: [Function: setMaxListeners],
        emit: [Function: emit],
        addListener: [Function: addListener],
        on: [Function: addListener],
        once: [Function: once],
        removeListener: [Function: removeListener],
        removeAllListeners: [Function: removeAllListeners],
        listeners: [Function: listeners],
        route: '/',
        stack: [Object],
        init: [Function],
        defaultConfiguration: [Function],
        engine: [Function],
        param: [Function],
        set: [Function],
        path: [Function],
        enabled: [Function],
        disabled: [Function],
        enable: [Function],
        disable: [Function],
        configure: [Function],
        get: [Function],
        post: [Function],
        put: [Function],
        head: [Function],
        delete: [Function],
        options: [Function],
        trace: [Function],
        copy: [Function],
        lock: [Function],
        mkcol: [Function],
        move: [Function],
        propfind: [Function],
        proppatch: [Function],
        unlock: [Function],
        report: [Function],
        mkactivity: [Function],
        checkout: [Function],
        merge: [Function],
        'm-search': [Function],
        notify: [Function],
        subscribe: [Function],
        unsubscribe: [Function],
        patch: [Function],
        all: [Function],
        del: [Function],
        render: [Function],
        request: {},
        response: {},
        cache: {},
        settings: [Object],
        engines: {},
        viewCallbacks: [],
        _events: [Object],
        _router: [Object],
        routes: [Object],
        router: [Getter],
        locals: [Object],
        _usedRouter: true },
     _headers:
      { 'x-powered-by': 'Express',
        vary: 'Accept-Encoding',
        'access-control-allow-origin': '*',
        'access-control-allow-methods': 'GET,PUT,POST,DELETE,OPTIONS',
        'access-control-allow-headers': 'Origin, X-Requested-With, Content-Type, Accept',
        'access-control-allow-credentials': 'true',
        'access-control-max-age': '3600' },
     _headerNames:
      { 'x-powered-by': 'X-Powered-By',
        vary: 'Vary',
        'access-control-allow-origin': 'Access-Control-Allow-Origin',
        'access-control-allow-methods': 'Access-Control-Allow-Methods',
        'access-control-allow-headers': 'Access-Control-Allow-Headers',
        'access-control-allow-credentials': 'Access-Control-Allow-Credentials',
        'access-control-max-age': 'Access-Control-Max-Age' },
     req: [Circular],
     viewCallbacks: [],
     locals: [Function: locals],
     end: [Function],
     write: [Function] },
  next: [Function: next],
  _startTime: Wed Apr 08 2015 14:00:00 GMT+0200 (CEST),
  originalMethod: 'POST',
  secret: undefined,
  cookies: {},
  signedCookies: {},
  sessionStore:
   { sessions: { 'KaN+isc0k/4XFi0Ey4FWCEcA': '{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"}}' },
     generate: [Function],
     _events: { disconnect: [Function], connect: [Function] } },
  sessionID: 'HtzA85T1hgJDlgp6k5UP208J',
  session:
   { cookie:
      { path: '/',
        _expires: null,
        originalMaxAge: null,
        httpOnly: true } },
  _route_index: 0,
  route:
   { path: '/direct',
     method: 'post',
     callbacks: [ [Function] ],
     keys: [],
     regexp: /^\/direct\/?$/i,
     params: [] },
  params: [] }

Still appreciating your hints. Thx.

jurisv commented 9 years ago

Please take a look at the latest example. The problem with missing body is related to bodyParser. You have to add the lines: // parse application/x-www-form-urlencoded app.use(bodyParser.urlencoded({ extended: true }));

// parse application/json app.use(bodyParser.json());