Node.js & Express From Scratch [Part 5] - Save Articles to MongoDB

preview_player
Показать описание
In this video we will create the form to add articles to the MongoDB database and the route to submit to. We will also add the bodyparser module.

CODE: Full code for this series

COURSE: Full course this project is based on

SUPPORT: We spend massive amounts of time creating these free videos, please donate to show your support:

FOLLOW TRAVERSY MEDIA:
Рекомендации по теме
Комментарии
Автор

You're the best IT teacher I've ever seen :) Thx a lot, these lessons are reeeeally useful for me.
And I wanna say special thx for your comments because I'm from Russia and, obviously, English isn't my native language, I'm currently at the advanced level and your video are more useful than just IT lessons :)

quantum-t
Автор

I get an, " Article not define" error after submitting the 2nd time on {9:50} pls help

memoton
Автор

nobody likes to show things like that, I had just said, that nobody showed something so simple to do a show node.js, mongodb, pug, express, nodemon, and html. in an example. just saying the words. this appeared. how good is God. for having a person like you. solo queria un ejemplo paso por paso como tu lo has hechos. ya que yo trabajo co c# bajo mvc. razor

franciscogerman
Автор

Very helpful video - I am looking forward to working through the rest of the series.

iancarr
Автор

4:17 What is the purpose of 'return' here?

surazzarus
Автор

Can we use static html css instead of pug templates?

sounak
Автор

a shorter way, i think (from another course)

let newArticle = req.body;
Article.create( newArticle, function( err ) {
if ( err ) throw err;
res.redirect( '/' );
}

Also, thanks for the series!

quentinmckay
Автор

I have an issue at this part. When I submit the form the data goes in the db just fine and I get redirected to the homepage but the new title is not showing on the homepage until I restart the server

paulalexandru
Автор

i have seen your video adding data to mongodb nodejs app . it worked bt when i see in mongo compass it only shows id, chunk size, update date etc .. itsnt it possible to view the data as it is in mongo compass like pdf as pdf plzz help me sir

ashwinideshbhratar
Автор

just amazing!, I'm gonna take this make a similar app to get used to this.

guitar
Автор

i'm having a problem where the data filled from the form is not saved to mongodb (I can't find it), but i am able to log all the data filled to the console.. can you help me..

kemaldwiheldy
Автор

I tried this code the data is going into mongoDB but its not displaying on homepage its showning unhandled error can u suggest any solution

williamcastelino
Автор

1:52 I feel like such a nitpick now, but using the same _id_ attribute name (form-group) more than once _works_ but it's bad practice because it will render the _.getElementById()_ method useless. Instead a _class_ attribute should be used. You can have more than one of those per page, and that array of elements with the same class name can then be picked up using the _.getElementsByClassName()_ method.

kebman
Автор

After adding the body-parser to the code and uses the console.log(req.body.title) I still get undefined. Any suggestions ?

hussainelzaiem
Автор

When I try to submit it is giving a CastError and I searched it on the internet but I didn't find the right thing to solve the problem... Maybe you can help?

noboss
Автор

Does anyone out there know why I don't see any CSS on any GitHub page that I go to ??? it looks like dull website with no style sheet at all...

ausitnlarsen
Автор

Your videos are very helpful for my project. I just don't get the part when you do "article.save(....)" at the end of video is it same to the "db. articles.insert(...)" in command prompt?

surajoberai
Автор

Nice series so far going pretty good, I'm changing it up slightly to be a notes app. Something I can actually use while I'm studying.

my vscode puts a line through bodyParser says its deprecated. I stumbled across using express instead. I'm assuming express just updated to have its own body parser?

fathersondiecast
Автор

Hi, i did not understand, how have you received the data from from inputs ? you did not write any code for that, usually you store value of the inputs then we send it to server like : $("id of the input").val . we store this val in variable then we send it to the server

tarekkhatib
Автор

How do you solve 304 problems without clearing cache? after several tests the page loads empty content and 304 status.

paolo-