SHARE

Yo gang, in this REST API tutorial I’ll show you how we can use the Express Router to create our routes for GET, POST, PUT & DELETE requests. The Express Router can help to modularize our code into logical components.

—– 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

25 COMMENTS

  1. hello, please i am having a little challenges with #7 video 8:10, POST request and Body Parser, i tried installing the body parser the way you explained it. but i am having this error $ npm install body-parser –save
    [email protected] C:xampphtdocsrest-api-playlist
    `– [email protected].2

    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected]^1.0.0 (node_moduleschokidarnode_modulesfsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    npm WARN [email protected] No description
    npm WARN [email protected] No repository field.

    any body can help me please!

  2. Hi,
    Love your tuts, but im facing an error in this one.
    when i use "nodemon index" in cmd, it gives the following error :
    ''nodemon' is not recognized as an internal or external command,
    operable program or batch file.'
    Any help?

  3. Hey there, Thanks a ton for these videos! Frankly speaking, I haven't found much videos around in regards to NodeJS + ExpressJS that can explain in detail the way you do in a short 12:20 mins. Great great stuff!

    Now for my questions…I get the fact that we use app.use(routes); so that index can see api.js….But what advantage does app.use('/api', routes) give? Isn't it just extra typing to do so when localhost:3000/ninjas works perfectly?

    Thank you 🙂 Keep up the amazing videos!

  4. Tried nodemon usind cmd:

    C:UsersJSDocumentsrest-api-playlist>npm install nodemon –save-dev
    [email protected] C:UsersJSDocumentsrest-api-playlist
    `– [email protected].0

    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected]^1.0.0 (node_moduleschokidarnode_modulesfsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    npm WARN [email protected] No description
    npm WARN [email protected] No repository field.

    C:UsersJSDocumentsrest-api-playlist>nodemon index
    Der Befehl "nodemon" ist entweder falsch geschrieben oder
    konnte nicht gefunden werden. (Translation: The Order "nodemon" is written wrong or could not be found.)

    What went wrong?
    (Rest worked fine btw, thx 🙂 )

  5. If you have an error, change your index.js code with this one

    const express = require('express');
    const routes = require('./routes/api');

    //set up express
    const app = express();

    //listen for requests
    app.listen(process.env.port || 4000, function () {
    console.log('hi');
    });

  6. Hello, thanks for great tut. As we require express in two seperate files are there two different express objects or are these two objects same and shared in both files? Is the program chaching the first express obj and using it in the second router file?

  7. Hello. This is a very good series. Thank you!
    In Ubuntu 16 I had to install nodemon globally to work (with parameter -g):
    npm install nodemon -g –save-dev

  8. Hello, first of all thanks for this series..
    I'm facing one problem regarding nodemon command on my PC it shows me following error..
    ——————————————————————————————————
    λ nodemon index
    'nodemon' is not recognized as an internal or external command,
    operable program or batch file.
    ——————————————————————————————————
    what should I do?

  9. app.use('/api', routes);
    is way cleaner than
    app.use('/api', require('./routes/api.js'));
    I don't know why you decided to change that :p Awareness that u can do it maybe?

LEAVE A REPLY

Please enter your comment!
Please enter your name here