I do not understand why it is impossible to get the value of singUp

router.get('/', async (request, response) => { let model = new Model(); response.send(model.account.singUp); }); function Model(){ } Model.prototype.account = { singUp: 1, activate: 1 } 

I do not understand what swears, the problem is definitely not in the send method

 express deprecated res.send(status): Use res.sendStatus(status) instead routers/others/test.js:12:12 ***/node_modules/mysql/lib/protocol/Parser.js:80 throw err; // Rethrow non-MySQL errors ^ RangeError: Invalid status code: 1 at ServerResponse.writeHead (_http_server.js:194:11) at ServerResponse.writeHead (***/node_modules/on-headers/index.js:55:19) at ServerResponse._implicitHeader (_http_server.js:185:8) at ServerResponse.end (_http_outgoing.js:754:10) at writeend (***/node_modules/express-session/index.js:261:22) at ontouch (***/node_modules/express-session/index.js:348:11) at Query._callback (***/node_modules/express-mysql-session/index.js:254:17) at Query.Sequence.end (***/node_modules/mysql/lib/protocol/sequences/Sequence.js:88:24) at Query._handleFinalResultPacket (***/node_modules/mysql/lib/protocol/sequences/Query.js:139:8) at Query.OkPacket (***/node_modules/mysql/lib/protocol/sequences/Query.js:72:10) at Protocol._parsePacket (***/node_modules/mysql/lib/protocol/Protocol.js:279:23) at Parser.write (***/node_modules/mysql/lib/protocol/Parser.js:76:12) at Protocol.write (***/node_modules/mysql/lib/protocol/Protocol.js:39:16) at Socket.<anonymous> (***/node_modules/mysql/lib/Connection.js:103:28) at emitOne (events.js:116:13) at Socket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at Socket.Readable.push (_stream_readable.js:208:10) at TCP.onread (net.js:607:20) 

Tell me is it possible to even refer to the elements of the object?

1 answer 1

As stated in the description :

Can be a Buffer object, a String, an object, or an Array

The body parameter can be a Buffer object, a string, an object, or an array.

In this case, the number is transmitted and there is an attempt to cause an outdated overload send send status.

To solve, you need to send either the object itself

 response.send(model.account); 

Or store in the fields of the object not numbers, but lines:

 singUp: '1'