It crashes when connet without tablename
Opened this issue · 3 comments
It works, but not as long.
When i go to http://192.168.50.44:8000/posts/1, i see correct output:
[{"id":1,"title":"testtitle","content":"Testcontent","created":"0000-00-00"}]
But when i go to http://192.168.50.44:8000/posts/, i cant see tablenames, i see just
[]
But when i go to http://192.168.50.44:8000, it crashes:
/mysql/lib/protocol/Parser.js:80
throw err; // Rethrow non-MySQL errors
^
TypeError: First argument must be a string or Buffer
at ServerResponse.end (_http_outgoing.js:739:13)
at Query. (/home/grimakon/apinode/js-crud-api/app.js:90:12)
at Query. (/home/grimakon/node_modules/mysql/lib/Connection.js:502:10)
at Query._callback (/home/grimakon/node_modules/mysql/lib/Connection.js:468:16)
at Query.Sequence.end (/home/grimakon/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)
at Query.ErrorPacket (/home/grimakon/node_modules/mysql/lib/protocol/sequences/Query.js:90:8)
at Protocol._parsePacket (/home/grimakon/node_modules/mysql/lib/protocol/Protocol.js:278:23)
at Parser.write (/home/grimakon/node_modules/mysql/lib/protocol/Parser.js:76:12)
at Protocol.write (/home/grimakon/node_modules/mysql/lib/protocol/Protocol.js:38:16)
at Socket. (/home/grimakon/node_modules/mysql/lib/Connection.js:91:28)
when i go to http://192.168.50.44:8000/posts/
Can you try: http://192.168.50.44:8000/posts (without trailing slash)?
when you go to http://192.168.50.44:8000
The behavior is undefined for that case.
when i go to http://192.168.50.44:8000/posts/
Can you try: http://192.168.50.44:8000/posts (without trailing slash)?
when you go to http://192.168.50.44:8000
The behavior is undefined for that case.
The result is the same without trailing slash and with trailing slash - it show "[]".
When i go to go to http://192.168.50.44:8000 why it is crashes?
when i go to http://192.168.50.44:8000/posts/
Can you try: http://192.168.50.44:8000/posts (without trailing slash)?
when you go to http://192.168.50.44:8000
The behavior is undefined for that case.
How i can to define the behavior in this case? Can you help me? I am new in coding.