SHARE

Yo gang, in this Node JS tutorial for beginners I’ll show you how we can serve JSON data to the client / browser. This is useful when handling AJAX requests from JavaScript which runs client-side, and to provide some kind of API end-point.

—– COURSE LINKS:
+ Repo – https://github.com/iamshaunjp/node-js-playlist
+ Atom editor – https://atom.io/

———————————————————————————————
You can find more front-end development tutorials on CSS, HTML, JavaScript, jQuery, WordPress & more on the channel homepage…

SUBSCRIBE TO CHANNEL – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg?sub_confirmation=1

========== JavaScript for Beginners Playlist ==========

https://www.youtube.com/playlist?list=PL4cUxeGkcC9i9Ae2D9Ee1RvylH38dKuET

============ CSS for Beginners Playlist =============

https://www.youtube.com/playlist?list=PL4cUxeGkcC9gQeDH6xYhmO-db2mhoTSrT

============== The Net Ninja =====================

For more front-end development tutorials & to black-belt your coding skills, head over to – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg or http://thenetninja.co.uk

================== Social Links ==================

Twitter – @TheNetNinja – https://twitter.com/thenetninjauk

12 COMMENTS

  1. How signifcant is the content type when serving up JSON? It looks like the browser renders the same thing with text/plain and application/json

  2. I am getting the error:

    "
    TypeError: Header name must be a valid HTTP Token ["Content-Type:"]
    "

    Is anyone else getting this?

  3. What if we want to read text stream from a .txt file and send it to client as a JSON value. How can we use the concept of PIPE there to read file in text and send it to client in JSON format. How will JSON.stringify() be carried out in this step – myReadStream.pipe(res) .

LEAVE A REPLY

Please enter your comment!
Please enter your name here