ENGLISH

Web Development with MongoDB and NodeJS

Book information

Publisher
Packt Publishing Ltd
Year
2015
ISBN
1785287451, 9781785287459
Language
english
Format
PDF
Filesize
4 MB (4688980 bytes)
Pages
300\301
Time added
2022-02-25 00:07:50

Description

Build an interactive and full-featured web application from scratch using Node.js and MongoDB About This BookConfigure your development environment to use Node.js and MongoDBUse Node.js to connect to a MongoDB database and perform data manipulationsA practical guide with clear instructions to design and develop a complete web application from start to finishWho This Book Is For This book is designed for JavaScript developers of any skill level that want to get up and running using Node.js and MongoDB to build full-featured web applications. A basic understanding of JavaScript and HTML is the only requirement for this book. What You Will LearnConfigure your development environment to use Node.js and MongoDBWrite and configure a web server using Node.js powered by the Express.js frameworkBuild dynamic HTML pages using the Handlebars template enginePersist application data using MongoDB and Mongoose ODMTest your code using automated testing tools such as the Mocha frameworkDeploy the development environment to the cloud using services such as Heroku, Amazon Web Services, and Microsoft AzureExplore Single-Page application frameworks to take your web applications to the next levelIn Detail Node.js and MongoDB are quickly becoming one of the most popular tech stacks for the web. Powered by Google's V8 engine, Node.js caters to easily building fast, scalable network applications while MongoDB is the perfect fit as a scalable, high-performance, open source NoSQL database solution. Using these two technologies together, web applications can be built quickly and easily and deployed to the cloud with very little difficulty. The book will begin by introducing you to the groundwork needed to set up the development environment. Here, you will quickly run 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 for interaction with web apps. It then moves on to show you how to use controllers and view models to generate reusable code that will reduce development time. Toward the end of the book, we will cover tests to properly execute the code and some popular frameworks for developing web applications. By the end of the book, you will have a running web application developed with MongoDB and Node.js along with it's popular frameworks. Style and approach An easy guide to Node.js and MongoDB, which will quickly introduce you to the relevant concepts by taking you through the different steps involved in building a full-fledged web application. Cover Copyright Credits About the Authors About the Reviewers www.PacktPub.com Table of Contents Preface Chapter 1: Welcome to JavaScript in the Full Stack A short introduction to Node.js The advantage that the V8 engine brings in Node.js is single threaded! Non-blocking asynchronous execution npm – the Node Package Manager Sharing and reusing JavaScript Not just for building web servers! Real-time web application with Socket.io Networking and file IO The origin of io.js A simple server with Node.js When to use Node.js? The NoSQL movement A short introduction to MongoDB Features of MongoDB Node and MongoDB in the wild What to expect from this book Summary Chapter 2: Getting Up and Running Installing Node.js Mac OS X Windows Linux Testing whether Node.js is installed properly Online documentation Installing Monod Mac OS X installation instructions Windows 7 / Windows 8 installation instructions Linux installation instructions Confirming successful Monod installation Bookmark the online documentation Writing your first app Creating the sample application Getting the dependent modules in place Adding the application code Understanding the code Launching the sample app Checking the actual database Summary Chapter 3: Node and MongoDB Basics A JavaScript primer Syntax basics Data types Understanding the scope of variables Operators and flows Understanding objects Understanding arrays Understanding functions Anonymous functions and callbacks JSON The basics of Node.js Event-driven Asynchronous execution The module system The Node.js core Installing modules using npm The basics of MongoDB The Mongo shell Inserting data Querying Updating data Deleting data Additional resources Summary Chapter 4: Introducing Express Web application frameworks What is Express.js? Building a complete web application Designing the web application Organizing the files Creating the application's entry point Booting up the application Using and understanding middleware The configure module Activating the configure module Routers and controllers Custom middleware Handlebars as view engines Summary Chapter 5: Templating with Handlebars Templating engines Server-side and client-side templating Client-side templating Server-side templating Views Layouts Partial views The basics of Handlebars Binding an object to the template Embedding presentation logic Handlebars helpers Global helpers View-specific helpers Rendering the views Summary Chapter 6: Controllers and View Models Controllers View models Updating the home controller Updating the image controller Displaying an image Uploading an image Helpers for reusable code The sidebar module The stats module The images module The comments module Testing the sidebar implementation Iterating on the UI Summary Chapter 7: Persisting Data with MongoDB Using MongoDB with Node.js Connecting to MongoDB Inserting a document Retrieving a document Introducing Mongoose Schemas Models Built-in validation Static methods Virtual properties Connecting with Mongoose Defining the schemas and models The models index file Adding CRUD to the controllers The home controller The image controller Index – retrieving an image model Create – inserting an image model Testing everything out so far The Like button and updating an image model Comment – inserting a comment model Wrapping it up Helpers Introducing the async module The comments helper The sidebar helper Troubleshooting The stats helper The popular images helper Iterating by adding an image removal capability Adding a route Adding a controller handler Updating the Handlebars image page template Updating jQuery Refactoring and improvements Summary Chapter 8: Creating a RESTful API What is an API? What is a RESTful API? Introducing Postman REST Client Installation instructions A quick tour of Postman REST Client Using the JSONView Chrome extension Creating a basic API server Creating sample JSON data Responding to GET requests Receiving data – POST and PUT requests Removing data – DELETE Consuming external APIs from Node.js Consuming an API endpoint using request Summary Chapter 9: Testing Your Code The tools of the trade Running tests with the Mocha framework Asserting tests with Chai.js Getting started with Chai Spies and stubs with Sinon.js Stubbing node modules with Proxyquire Writing and running your first test Writing a test helper Testing the application Testing the routes Testing the server Testing a model Testing a controller Spy and stub everything! Summary Chapter 10: Deploying with Cloud-Based Services Cloud versus traditional hosting Infrastructure as a Service versus Platform as a Service An introduction to Git Deploying your application Nodejitsu Heroku Amazon Web Services Create a MongoLab account and database Create and configure the AWS environment Microsoft Azure Digital Ocean Summary Chapter 11: Single Page Applications with Popular Frontend Frameworks What is a single page application? Why use a frontend framework? The TodoMVC project Backbone.js Ember.js AngularJS Frontend development tools Automated build task managers Dependency management Modularity HTML template-rendering engines CSS transpiling Testing and test-driven development PhantomJS headless browser Summary Chapter 12 : Popular Node.js Web Frameworks Koa Meteor Sails Hapi Flatiron Summary Index

Similar books

Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36

Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36

2010 · PDF

THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.

THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.

1858 · PDF

Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.

Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.

2022 · PDF

The travels of Capts. Lewis and Clarke from St. Louis, by way of the Missouri and Columbia rivers, to the Pacific ocean; performed in the years 1804, 1805 & 1806, by order of the government of the United States. Containing delineations of the manners, customs, religion, &c. of the Indians, comp. from various authentic sources, and original documents, and a summary of the Statistical view of the Indian nations, from the official communication of Meriwether Lewis. Illustrated with a map of the country, inhabited by the western tribes of Indians

The travels of Capts. Lewis and Clarke from St. Louis, by way of the Missouri and Columbia rivers, to the Pacific ocean; performed in the years 1804, 1805 & 1806, by order of the government of the United States. Containing delineations of the manners, customs, religion, &c. of the Indians, comp. from various authentic sources, and original documents, and a summary of the Statistical view of the Indian nations, from the official communication of Meriwether Lewis. Illustrated with a map of the country, inhabited by the western tribes of Indians

1809 · PDF