Mongoose JS Tutorial - 5 - Build a CRUD App (3)

Publié le: 08 février 2016
sur la chaîne: JsWiz
22,916
153

Full Course: https://goo.gl/rT7o2k

Part 3 of Building a CRUD app Using Node.js, Mongoose and Express.js.

Get Javascript Skills: http://jswiz.net

This video will cover how to create new Books using the POST method. We'll be using Postman to demonstrate how to how to add a new Book to our model.

So far we've looked at how to find All books and a single book from our collection.

The first thing we need to do is add body-parser and set urlencoded to true and json capabilities.

Let's start by creating a new Post route. There are 2 common ways to do this that you'll come across so we'll take a look at both. The first one, you'll ceate a variable assigned to an instance of your Schema. Then we'll specify exactly what should be passed. This is the more common method of POSTing items to your mongoose collection. And it helps in preventing errors that may occur when handling data between the front end and back end.

Repo for the code:
https://github.com/jakblak/MongooseJS...


Sur cette page du site, vous pouvez voir la vidéo en ligne Mongoose JS Tutorial - 5 - Build a CRUD App (3) durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur JsWiz 08 février 2016, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 22,916 fois et il a aimé 153 téléspectateurs. Bon visionnage!