SHARE

—– COURSE LINKS:
+ Repo – https://github.com/iamshaunjp/rest-api-playlist
+ Atom editor – https://atom.io/a
+ Download GIT – https://git-scm.com/
+ Node.js for Beginners Playlist –
https://www.youtube.com/playlist?list=PL4cUxeGkcC9gcy9lrvMJ75z9maRw4byYp
+ MongoDB playlist – https://www.youtube.com/playlist?list=PL4cUxeGkcC9jpvoYriLI0bY8DOgWZfi6u

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

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

========== PSD to WordPress Playlist ==========

https://www.youtube.com/playlist?list=PL4cUxeGkcC9gnow7e45LQFkNVxwQ5BH-W

============ Node.js for Beginners Playlist =============

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

============== 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

14 COMMENTS

  1. Note If you want to use raw need to take care of following things 01 Raw 02 JSON (application/json) 03 {"key" : "value"} Note Json should be in double quote if you enter with single quote it will give you error(SyntaxError: Unexpected token ' in JSON at position 24).

  2. I just encounter a strange problem if your raw data should be in double quotes only ie "name" : "Prashant" if you use in single quote it will generate the error (SyntaxError: Unexpected token ' in JSON at position 24).

  3. hi netninja your tutorials are excellent but i have one question, could you please tell me why are you using const instead of var for express or bodyparser?

  4. Hey, guys! If you get an error "Cannot read property 'name' of undefined", try to create a "port" const (like this: const port = parseInt(process.env.port, 10) || 4000;) and move it to the head of the index.js before the middleware. That solved me this problem.

    BTW, The Net Ninja, you rock, thanks for all the tutorials!!!

  5. Love your tutorials… even though they're Windows-centric. Following along in Linux, unfortunately nodemon fails to install and I'm not sure which app you're running to visualise the json (Postman? linux equivalent?) – guess I have to wing the rest of the tutorial. Also, would love your views of creating a RESTful API in php… do-able?

  6. For everybody whose body parser logs an empty object:

    You have to send the post request with the header Content-Type: application/json

  7. Hey man! thanks for this videos! Awesome! You are gonna do something about deploying in production or something like that? It will be really great! Thanks again!

  8. I have a question and I hope somebody here answers it:
    Q – If I use middleware as app.use(bodyParser.json()) then wouldn't all my requests body would be converted to JSON? Lets say I want other type of request body too like XML or something, then using your way each xml data will also be parsed as JSON.
    Is there a way to inject middleware to only specific request or and not all?

LEAVE A REPLY

Please enter your comment!
Please enter your name here