Use the two popular web development stacks, Node.js and MongoDB, to build full-featured web applications
About This Book
- Learn the new ECMAScript along with Node 8 and MongoDB to make your application more effective.
- Get the up-to-date information required to launch your first application prototype using the latest versions of Node.js and MongoDB.
- A practical guide with clear instructions to designing and developing a complete web application from start to finish using trending frameworks such as angular4 and hapi
Who This Book Is For
What You Will Learn
- Work with Node.js building blocks
- Write and configure a web server using Node.js powered by the Express.js framework
- Build dynamic HTML pages using the Handlebars template engine
- Persist application data using MongoDB and Mongoose ODM
- Test your code using automated testing tools such as the Mocha framework
- Automate test cases using Gulp
- Reduce your web development time by integrating third-party tools for web interaction.
- Deploy a development environment to the cloud using services such as Heroku, Amazon Web Services, and Microsoft Azure
- Explore single-page application frameworks to take your web applications to the next level
Node.js builds fast, scalable network applications while MongoDB is the perfect fit as a high-performance, open source NoSQL database solution. The combination of these two technologies offers high performance and scalability and helps in building fast, scalable network applications. Together they provide the power for manage any form of data as well as speed of delivery.
This book will help you to get these two technologies working together to build web applications quickly and easily, with effortless deployment to the cloud. You will also learn about angular 4, which consumes pure JSON APOIs from a hapi server.
The book begins by setting up your development environment, running you through the steps necessary to get the main application server up-and-running. Then you will see how to use Node.js to connect to a MongoDB database and perform data manipulations.
From here on, the book will take you through integration with third-party tools to interact with web apps. You will see how to use controllers and view models to generate reusable code that will reduce development time. Toward the end, the book supplies tests to properly execute your code and take your skills to the next level with the most popular frameworks for developing web applications.
By the end of the book, you will have a running web application developed with MongoDB, Node.js, and some of the most powerful and popular frameworks.
Style and approach
A practical guide with clear instructions to designing and developing a complete web application from start to finish
Table of Contents
- A short introduction to Node.js
- npm - the Node Package Manager
- A simple server with Node.js
- The NoSQL movement
- A short introduction to MongoDB
- Node.js and MongoDB in the wild
- What to expect from this book
Getting Up and Running
- Installing Node.js
- Installing MongoDB
- Writing your first app
- Adding the application code
Node and MongoDB Basics
- The basics of Node.js
- Installing modules using npm
- The basics of MongoDB
- Additional resources
- Web application frameworks
- What is Express.js?
- Building a complete web application
- The configure module
- Routers and controllers
- Handlebars as View engines
Templating with Handlebars
- Templating engines
- Server-side and client-side templating
- The basics of Handlebars
- Partial views
- Handlebars helpers
- Rendering the views
- Controllers and View Models
Persisting Data with MongoDB
- Using MongoDB with Node.js
- Introducing Mongoose
- Defining the schemas and models
Adding CRUD to the controllers
- The home controller
- The image controller
- Iterating by adding an image removal capability
- Refactoring and improvements
Creating a RESTful API
- What is an API?
- What is a RESTful API?
- Introducing Postman REST Client
- Creating a basic API server
- Responding to GET requests
- Receiving data - POST and PUT requests
- Removing data - DELETE
- Consuming external APIs from Node.js
Testing Your Code
- The tools of the trade
- Writing and running your first test
- Testing the application
- Spy and stub everything!
- Automating everything
- Deploying with Cloud-Based Services
- Popular Node.js Web Frameworks
Single Page Applications with Popular Frontend Frameworks
- Why use a frontend framework?
- What is a single page application?
- Frontend development tools
- Testing and test-driven development
- Title: Web Development with MongoDB and Node - Third Edition
- Release date: September 2017
- Publisher(s): Packt Publishing
- ISBN: 9781788395083