前端相关. Contribute to twang/frontEnd development by creating an account on GitHub. About Web Development with nbafinals.info and MongoDB. Duration: 3 hours 54 minutes. Web development technology moves at a very fast pace with new tools and. Build an interactive and full-featured web application from scratch using nbafinals.info and MongoDB.
|Language:||English, Spanish, Japanese|
|Distribution:||Free* [*Sign up for free]|
For this tutorial, we will need a very simple Schema that has only two fields. I am going to call the field firstName and lastName. The data stored in both fields will be a String.
After connecting to the database in our app. Here are the lines you need to add to the app. Here is the line you will add next to create our mode. We will need to create an endpoint that will be used to send data to our server.
Once the server receives this data then it will store the data in the database. An endpoint is a route that our server will be listening to to get data from the browser. The following table explains what each HTTP verb does. As you can see from these verbs, they form the basis of CRUD operations that I talked about previously.
We will now create this endpoint. To get started this is what the framework of our endpoint will look like. The values for firstName and lastName are in the body of the request that we send to the server. We want to capture that data, convert it to JSON and store it into the database. To parse the data in the body we will need to add middleware into our application to provide this functionality. We will be using the body-parser module.
We need to install it, so in your terminal window enter the following command. The configuration will allow us to pass the data for firstName and lastName in the body to the server.
It can also convert that data into JSON format. This will be handy because we can take this formatted data and save it directly into our database. To add the body-parser middleware to our application and configure it, we can add the following lines directly after the line that sets our port. To save the data into the database, we need to create a new instance of our model that we created early.
Mongoose will return a promise on a save to the database. A promise is what is returned when the save to the database completes. Log in to your account. Not yet a member?
Register for an account and access leading-edge content on emerging technologies. Register now. Packt Logo. My Collection. Deal of the Day Understand the fundamentals of C programming and get started with coding from ground up in an engaging and practical manner. Sign up here to get these deals straight to your inbox. Find Ebooks and Videos by Technology Android.
Packt Hub Technology news, analysis, and tutorials from Packt. Insights Tutorials. News Become a contributor.
Categories Web development Programming Data Security. Subscription Go to Subscription. Subtotal 0. Title added to cart. Subscription About Subscription Pricing Login. Features Free Trial. Search for eBooks and Videos. Build an interactive and full-featured web application from scratch using Node. Are you sure you want to claim this product using a token? Quick links: What do I get with a Packt subscription? What do I get with an eBook?
What do I get with a Video? Frequently bought together. Learn more Add to cart. Mastering Node.
Chapter 6: Controllers and View Models. Chapter 7: Persisting Data with MongoDB. Chapter 8: Chapter 9: Testing Your Code. Chapter Deploying with Cloud-Based Services. Popular Node.
Authors Mithun Satheesh. Bruno Joseph D'mello. Jason Krol.