I am using MEAN, Displaying selected ( from browser) log files from the linux server using node js.
I am using MEAN, Displaying selected ( from browser) log files from the linux server using node js.
I am using angular HTTP get method to read logs from express server, store it in a variable and display in browser.
My problem is when I use response type as text, entire log file is formatted as single line, Please help me to fix this.
getData(server,value)
this.http.get(this.url/server/value, responseType: 'text' ).subscribe(res =>
this.data = res;
);
responseType: 'text'
How can you tell it's formatted as a single line? How are you displaying the value?
– user184994
Sep 5 '18 at 19:32
How is the server sending back the response? Is it a
json. How do you intend to show it on your UI?– SiddAjmera
Sep 5 '18 at 19:33
json
I am using to node js to filter the logs(using the time stamp in the logs). Using angular I am giving option to choose time frame as parameter (last 2 hours, between hh;mm to hh:mm). Depends on the option it will pass the parameter and execute the script in the linux server using ssh utils ,display using express and I am getting the output "responseType: 'text'", which is displaying as single line instead of the proper logs....
– Po....
Sep 6 '18 at 20:23
1 Answer
1
Use responseType: 'text' as 'text' or 'text as 'json'...for more information how non-json data work you may visit Requesting non-JSON data
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Why are you using
responseType: 'text'in the first place?– SiddAjmera
Sep 5 '18 at 19:25