DEV Community

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 a...
Collapse
 
rorrenoa profile image
Rorrenoa •

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"
Collapse
 
aurelkurtula profile image
aurel kurtula •

Yes.
Fixed it.
Thanks Rorrenoa

Collapse
 
fernandarachel profile image
Fernanda Rachel •

Amaaazing. You just saved my night. Thanks a lot

Collapse
 
aurelkurtula profile image
aurel kurtula •

Very nice to hear that. Thanks for the feedback

Collapse
 
pofigster profile image
Mark •

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?

Collapse
 
aurelkurtula profile image
aurel kurtula •

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

Collapse
 
aurelkurtula profile image
aurel kurtula •

I might create one

Collapse
 
rodrigues profile image
Leandro Rodrigues •

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?

Collapse
 
aurelkurtula profile image
aurel kurtula •

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.

Thanks

Collapse
 
itsmedeepakupadhya profile image
itsmedeepakupadhya •

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

Collapse
 
ventomaxi profile image
Maximiliano •

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

Collapse
 
aurelkurtula profile image
aurel kurtula •

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?

Collapse
 
ventomaxi profile image
Maximiliano •

Nop, sorry.. my bad! thanks again!

Collapse
 
codeify profile image
Codeify • • Edited

awesome post :)

Collapse
 
jessachandler profile image
Jess Chandler •

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

Collapse
 
joaorafaelsantos profile image
João Santos •

Good work :)

Collapse
 
olivermensahdev profile image
Oliver Mensah •

Awesome work

Collapse
 
aurelkurtula profile image
aurel kurtula •

Thanks Oliver

Collapse
 
ns23 profile image
Nitesh Sawant •

Nice article

Collapse
 
josemygel profile image
Jose Miguel Gómez Lozano •

Amazing documentation! Thanks you!

Collapse
 
aurelkurtula profile image
aurel kurtula •

Thanks Jose