售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
MEAN Web Development
Table of Contents
MEAN Web Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Introduction to MEAN
Three-tier web application development
The evolution of JavaScript
Introducing MEAN
Installing MongoDB
Installing MongoDB on Windows
Running MongoDB manually
Running MongoDB as a Windows Service
Installing MongoDB on Mac OS X and Linux
Installing MongoDB from binaries
Install MongoDB using a package manager
Using the MongoDB shell
Installing Node.js
Installing Node.js on Windows
Installing Node.js on Mac OS X
Installing Node.js on Linux
Running Node.js
Introducing NPM
Using NPM
The installation process of NPM
Installing a package using NPM
Removing a package using NPM
Updating a package using NPM
Managing dependencies using the package.json file
Creating a package.json file
Installing the package.json dependencies
Updating the package.json file
Summary
2. Getting Started with Node.js
Introduction to Node.js
JavaScript event-driven programming
Node.js event-driven programming
JavaScript closures
Node modules
CommonJS modules
Node.js core modules
Node.js third-party modules
Node.js file modules
Node.js folder modules
Developing Node.js web applications
Meet the Connect module
Connect middleware
Understanding the order of Connect middleware
Mounting Connect middleware
Summary
3. Building an Express Web Application
Introduction to Express
Installing Express
Creating your first Express application
The application, request, and response objects
The application object
The request object
The response object
External middleware
Implementing the MVC pattern
Application folder structure
Horizontal folder structure
Vertical folder structure
File-naming conventions
Implementing the horizontal folder structure
Handling request routing
Adding the routing file
Configuring an Express application
Environment configuration files
Rendering views
Configuring the view system
Rendering EJS views
Serving static files
Configuring sessions
Summary
4. Introduction to MongoDB
Introduction to NoSQL
Introducing MongoDB
Key features of MongoDB
The BSON format
MongoDB ad hoc queries
MongoDB indexing
MongoDB replica set
MongoDB sharding
MongoDB shell
MongoDB databases
MongoDB collections
MongoDB CRUD operations
Creating a new document
Creating a document using insert()
Creating a document using update()
Creating a document using save()
Reading documents
Finding all the collection documents
Using an equality statement
Using query operators
Building AND/OR queries
Updating existing documents
Updating documents using update()
Updating documents using save()
Deleting documents
Deleting all documents
Deleting multiple documents
Deleting a single document
Summary
5. Introduction to Mongoose
Introducing Mongoose
Installing Mongoose
Connecting to MongoDB
Understanding Mongoose schemas
Creating the user schema and model
Registering the User model
Creating new users using save()
Finding multiple user documents using find()
Advanced querying using find()
Reading a single user document using findOne()
Updating an existing user document
Deleting an existing user document
Extending your Mongoose schema
Defining default values
Using schema modifiers
Predefined modifiers
Custom setter modifiers
Custom getter modifiers
Adding virtual attributes
Optimizing queries using indexes
Defining custom model methods
Defining custom static methods
Defining custom instance methods
Model validation
Predefined validators
Custom validators
Using Mongoose middleware
Using pre middleware
Using post middleware
Using Mongoose DBRef
Summary
6. Managing User Authentication Using Passport
Introducing Passport
Installing Passport
Configuring Passport
Understanding Passport strategies
Using Passport's local strategy
Installing Passport's local strategy module
Configuring Passport's local strategy
Adapting the User model
Creating the authentication views
Modifying the user controller
Displaying flash error messages
Installing the Connect-Flash module
Configuring Connect-Flash module
Using Connect-Flash module
Wiring the user's routes
Understanding Passport OAuth strategies
Setting up OAuth strategies
Handling OAuth user creation
Using Passport's Facebook strategy
Installing Passport's Facebook strategy
Configuring Passport's Facebook strategy
Wiring Passport's Facebook strategy routes
Using Passport's Twitter strategy
Installing Passport's Twitter strategy
Configuring Passport's Twitter strategy
Wiring Passport's Twitter strategy routes
Using Passport's Google strategy
Installing Passport's Google strategy
Configuring Passport's Google strategy
Wiring Passport's Google strategy routes
Summary
7. Introduction to AngularJS
Introducing AngularJS
Key concepts of AngularJS
The core module of AngularJS
The angular global object
AngularJS modules
Application modules
External modules
Third-party modules
Two-way data binding
Dependency injection
Dependency injection in AngularJS
AngularJS directives
Core directives
Custom directives
Bootstrapping an AngularJS application
Automatic bootstrap
Manual bootstrap
Installing AngularJS
Meeting the Bower dependencies manager
Configuring the Bower dependencies manager
Installing AngularJS using Bower
Configuring AngularJS
Structuring an AngularJS application
Bootstrapping your AngularJS application
AngularJS MVC entities
AngularJS views
AngularJS controllers and scopes
AngularJS routing
Installing the ngRoute module
Configuring the URL scheme
AngularJS application routes
AngularJS services
AngularJS prebundled services
Creating AngularJS services
Using AngularJS services
Managing AngularJS authentication
Rendering the user object
Adding the Authentication service
Using the Authentication service
Summary
8. Creating a MEAN CRUD Module
Introducing CRUD modules
Setting up the Express components
Creating the Mongoose model
Setting up the Express controller
The error handling method of the Express controller
The create() method of the Express controller
The list() method of the Express controller
The read() middleware of the Express controller
The update() method of the Express controller
The delete() method of the Express controller
Implementing an authentication middleware
Implementing an authorization middleware
Wiring the Express routes
Configuring the Express application
Introducing the ngResource module
Installing the ngResource module
Using the $resource service
Implementing the AngularJS MVC module
Creating the AngularJS module service
Setting up the AngularJS module controller
The create() method of the AngularJS controller
The find() and findOne() methods of the AngularJS controller
The update() method of the AngularJS controller
The delete() method of the AngularJS controller
Implementing the AngularJS module views
The create-article view
The view-article view
The edit-article view
The list-articles view
Wiring the AngularJS module routes
Finalizing your module implementation
Summary
9. Adding Real-time Functionality Using Socket.io
Introducing WebSockets
Introducing Socket.io
The Socket.io server object
Socket.io handshaking
The Socket.io configuration middleware
The Socket.io client object
Socket.io events
Handling events
Emitting events
Socket.io namespaces
Socket.io server namespaces
Socket.io client namespaces
Socket.io rooms
Joining and leaving rooms
Emitting events to rooms
Installing Socket.io
Configuring the Socket.io server
Configuring the Socket.io session
Installing the connect-mongo and cookie-parser modules
Configuring the connect-mongo module
Configuring the Socket.io session
Building a Socket.io chat
Setting the event handlers of the chat server
Creating the Socket service
Creating the chat controller
Creating the chat view
Adding chat routes
Finalizing the chat implementation
Summary
10. Testing MEAN Applications
Introducing JavaScript testing
TDD, BDD, and unit testing
Test frameworks
Assertion libraries
Test runners
Testing your Express application
Introducing Mocha
Introducing Should.js
Introducing SuperTest
Installing Mocha
Installing the Should.js and SuperTest modules
Configuring your test environment
Writing your first Mocha test
Testing the Express model
Testing the Express controller
Running your Mocha test
Testing your AngularJS application
Introducing the Jasmine framework
AngularJS unit tests
Introducing Karma test runner
Installing the Karma command-line tool
Installing Karma's dependencies
Configuring the Karma test runner
Mocking AngularJS components
Introducing ngMock
Installing ngMock
Writing AngularJS unit tests
Testing modules
Testing controllers
Testing services
Testing routes
Testing directives
Testing filters
Writing your first unit test
Running your AngularJS unit tests
AngularJS E2E tests
Introducing the Protractor test runner
Installing the Protractor test runner
Configuring the Protractor test runner
Writing your first E2E test
Running your AngularJS E2E tests
Summary
11. Automating and Debugging MEAN Applications
Introducing the Grunt task runner
Installing the Grunt task runner
Configuring Grunt
Running your application using Grunt
Testing your application using Grunt
Linting your application using Grunt
Watching file changes using Grunt
Debugging Express with node-inspector
Installing node-inspector's grunt task
Configuring node-inspector's grunt task
Running the debug grunt task
Debugging AngularJS with Batarang
Using Batarang
Batarang Models
Batarang Performance
Batarang Dependencies
Batarang options
Summary
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜