Building a RESTful API with Express and MongoDB

aurel kurtula on February 07, 2018

Today we're continuing with our exploration of Express. In the last tutorial we created a basic website with Express.js. Now we're going to build... [Read Full]
markdown guide

Nice, thanks for sharing! Check that you forget the post method after adding put..


Check that you forget the post method after adding put..

The post method is on bookRouter.route('/') where as bookRouter.route('/:bookId') doesn't have a post method

Am I missing something?


I am working on a project where i am using mongodb as a backend and angular2 for front end. I have two collections in db as Country{id, countryname} and state{id, statename} I want to find all the states depending on the country , I tried to write a code using $lookup but getting nothing. Also i need to use these two collections in an angular application for cascading dropdown. If i Select “India” only “States” in india should populate.I am new to mongodb. Plz help


Amaaazing. You just saved my night. Thanks a lot


Very nice to hear that. Thanks for the feedback


Guys just a quick question,

According developer.mozilla.org/en-US/docs/W... the path request should have an array, at the body of the document, with descriptions of changes.
In the provided examples the body of the request is a JSON object which makes a lot of sense to me. Unfortunately, to confuse more my mind I have found this library, github.com/dharmafly/jsonpatch.js, that makes use of the approach that you can see at Mozilla URL.
So my question is: What the correct approach? Which is the recommended design?


Unless I am missing something it is an array of object.

Can you copy paste the code you are referring to where you believe I used an array? Then I might be able to help further.



First of all thank you for this amazing documentation!

Could it be that there are some " signs missing in the second coding part?

            title: Alice's Adventures in Wonderland",
            author: "Charles Lutwidge Dodgson"

Quick question - I've noticed that you're using babel-node to support using import and export statements. Do you have a tutorial on configuring your npm environment to support doing that?


Hey, I wrote that tutorial, you can read it here


Thanks for sharing! I am going to keep this one around for reference.

code of conduct - report abuse