Muutke küpsiste eelistusi

Getting MEAN with Mongo, Express, Angular, and Node [Pehme köide]

  • Formaat: Paperback / softback, 438 pages, kõrgus x laius x paksus: 230x190x20 mm, kaal: 767 g
  • Ilmumisaeg: 16-Dec-2015
  • Kirjastus: Manning Publications
  • ISBN-10: 1617292036
  • ISBN-13: 9781617292033
Teised raamatud teemal:
  • Pehme köide
  • Hind: 47,79 €*
  • * saadame teile pakkumise kasutatud raamatule, mille hind võib erineda kodulehel olevast hinnast
  • See raamat on trükist otsas, kuid me saadame teile pakkumise kasutatud raamatule.
  • Kogus:
  • Lisa ostukorvi
  • Tasuta tarne
  • Lisa soovinimekirja
  • Formaat: Paperback / softback, 438 pages, kõrgus x laius x paksus: 230x190x20 mm, kaal: 767 g
  • Ilmumisaeg: 16-Dec-2015
  • Kirjastus: Manning Publications
  • ISBN-10: 1617292036
  • ISBN-13: 9781617292033
Teised raamatud teemal:

Traditional web dev stacks can require different programming languages for every layer, creating a complex mashup of code and frameworks. Together, the MongoDB database, the Express and AngularJS web application frameworks, and Node.js on the server-side constitute the MEAN stack, a powerful web development platform that uses JavaScript top to bottom. Developers love it because they need only one programming language for the whole stack. Business owners love it because the open source technologies in the MEAN stack are scalable and cost effective. Most importantly, end users love it because your web apps are fast and responsive. It's a win-win-win!

Getting MEAN with Mongo, Express, Angular, and Node shows readers how to develop web applications end-to-end using the MEAN stack. It systematically discusses each technology in the MEAN stack helping to build up an application one layer at a time, just as in a real project. First, it tackles creating a skeleton of a static site in Express and Node, and pushing it up to a live web server. Next, it looks at the MongoDB database and how to build an API for an application. Finally, it rolls out Angular to handle data manipulation and application logic in the browser, demonstrating the payoff for organizing the back-end code properly. By the end of the book, readers will have all the skill—and code—needed to build a dynamic data-driven web application on the MEAN stack.

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.

Preface xv
Acknowledgments xvii
About this book xix
Part 1 Setting The Baseline
1(50)
1 Introducing full-stack development
3(21)
1.1 Why learn the full stack?
4(3)
A very brief history of web development
4(2)
The trend toward full-stack developers
6(1)
Benefits of full-stack development
6(1)
Why the MEAN stack specifically?
7(1)
1.2 Introducing Node.js: The web server/platform
7(5)
JavaScript: The single language through the stack
8(1)
Fast, efficient, and scalable
8(3)
Using prebuilt packages via npm
11(1)
1.3 Introducing Express: The framework
12(1)
Easing your server setup
12(1)
Routing URLs to responses
12(1)
Views: HTML responses
12(1)
Remembering visitors with session support
13(1)
1.4 Introducing MongoDB: The database
13(3)
Relational versus document databases
13(1)
MongoDB documents: JavaScript data store
14(1)
More than just a document database
14(1)
What is MongoDB not good for?
15(1)
Mongoose for data modeling and more
15(1)
1.5 Introducing AngularJS: The front-end framework
16(3)
jQuery versus AngularJS
16(1)
Two-way data binding: Working with data in a page
16(2)
Using AngularJS to load new pages
18(1)
Are there any downsides?
18(1)
1.6 Supporting cast
19(2)
Twitter Bootstrap for user interface
19(1)
Git for source control
20(1)
Hosting with Heroku
20(1)
1.7 Putting it together with a practical example
21(2)
Introducing the example application
21(1)
How the MEAN stack components work together
22(1)
1.8 Summary
23(1)
2 Designing a MEAN stack architecture
24(27)
2.1 A common MEAN stack architecture
25(1)
2.2 Looking beyond SPAs
26(2)
Hard to crawl
26(1)
Analytics and browser history
27(1)
Speed of initial load
27(1)
To SPA or not to SPA?
28(1)
2.3 Designing a flexible MEAN architecture
28(6)
Requirements for a blog engine
29(1)
A blog engine architecture
30(3)
Best practice: Build an internal API for a data layer
33(1)
2.4 Planning a real application
34(6)
Planning the application at a high level
35(1)
Architecting the application
36(2)
Wrapping everything in an Express project
38(1)
The end product
39(1)
2.5 Breaking the development into stages
40(7)
Rapid prototype development stages
40(1)
The steps to build Loc8r
41(6)
2.6 Hardware architecture
47(2)
Development hardware
47(1)
Production hardware
47(2)
2.7 Summary
49(2)
Part 2 Building A Node Web Application
51(340)
3 Creating and setting up a MEAN project
53(27)
3.1 A brief look at Express, Node, and npm
55(3)
Defining packages with package.json
55(1)
Installing Node dependencies with npm
56(2)
3.2 Creating an Express project
58(6)
Installing the pieces
58(1)
Creating a project folder
58(1)
Configuring an Express installation
59(2)
Creating an Express project and trying it out
61(1)
Restarting the application
62(2)
3.3 Modifying Express for MVC
64(6)
A bird's eye view of MVC
64(1)
Changing the folder structure
65(1)
Using the new views and routes folders
66(1)
Splitting controllers from routes
67(3)
3.4 Import Bootstrap for quick, responsive layouts
70(4)
Download Bootstrap and add it to the application
70(1)
Using Bootstrap in the application
70(4)
3.5 Make it live on Heroku
74(5)
Getting Heroku set up
74(2)
Pushing the site live using Git
76(3)
3.6 Summary
79(1)
4 Building a static site with Node and Express
80(40)
4.1 Defining the routes in Express
82(2)
Different controller files for different collections
83(1)
4.2 Building basic controllers
84(3)
Setting up controllers
85(1)
Testing the controllers and routes
86(1)
4.3 Creating some views
87(11)
A look at Bootstrap
88(1)
Setting up the HTML framework with Jade templates and Bootstrap
89(4)
Building a template
93(5)
4.4 Adding the rest of the views
98(8)
Details page
98(4)
Adding Review page
102(2)
The About page
104(2)
4.5 Take the data out of the views and make them smarter
106(13)
How to move data from the view to the controller
107(2)
Dealing with complex, repeating data
109(4)
Manipulating the data and view with code
113(1)
Using includes and mixins to create reusable layout components
113(2)
The finished homepage
115(2)
Updating the rest of the views and controllers
117(2)
4.6 Summary
119(1)
5 Building a data model with MongoDB and Mongoose
120(40)
5.1 Connecting the Express application to MongoDB using Mongoose
122(8)
Adding Mongoose to our application
123(1)
Adding a Mongoose connection to our application
124(6)
5.2 Why model the data?
130(4)
What is Mongoose and how does it work?
131(3)
5.3 Defining simple Mongoose schemas
134(13)
The basics of setting up a schema
135(2)
Using geographic data in MongoDB and Mongoose
137(1)
Creating more complex schemas with subdocuments
138(5)
Final schema
143(2)
Compiling Mongoose schemas into models
145(2)
5.4 Using the MongoDB shell to create a MongoDB database and add data
147(5)
MongoDB shell basics
147(1)
Creating a MongoDB database
148(4)
5.5 Getting our database live
152(7)
Setting up MongoLab and getting the database URI
152(2)
Pushing up the data
154(2)
Making the application use the right database
156(3)
5.6 Summary
159(1)
6 Writing a REST API: Exposing the MongoDB database to the application
160(42)
6.1 The rules of a REST API
161(6)
Request URLs
162(1)
Request methods
163(2)
Responses and status codes
165(2)
6.2 Setting up the API in Express
167(5)
Creating the routes
167(3)
Creating the controller placeholders
170(1)
Including the model
171(1)
Testing the API
172(1)
6.3 GET methods: Reading data from MongoDB
172(15)
Finding a single document in MongoDB using Mongoose
173(4)
Finding a single subdocument based on IDs
177(3)
Finding multiple documents with geospatial queries
180(7)
6.4 POST methods: Adding data to MongoDB
187(6)
Creating new documents in MongoDB
188(2)
Creating new subdocuments in MongoDB
190(3)
6.5 PUT methods: Updating data in MongoDB
193(4)
Using Mongoose to update a document in MongoDB
194(2)
Updating an existing subdocument in MongoDB
196(1)
6.6 DELETE method: Deleting data from MongoDB
197(3)
Deleting documents in MongoDB
198(1)
Deleting a subdocument from MongoDB
199(1)
6.7 Summary
200(2)
7 Consuming a REST API: Using an API from inside Express
202(189)
7.1 How to call an API from Express
203(3)
Adding the request module to our project
203(1)
Setting up default options
204(1)
Using the request module
204(2)
7.2 Using lists of data from an API: The Loc8r homepage
206(10)
Separating concerns: Moving the rendering into a named function
207(1)
Building the API request
207(1)
Using the API response data
208(1)
Modifying data before displaying it: Fixing the distances
209(3)
Catching errors returned by the API
212(4)
7.3 Getting single documents from an API: The Loc8r Details page
216(10)
Setting URLs and routes to access specific MongoDB documents
216(2)
Separating concerns: Moving the rendering into a named function
218(1)
Querying the API using a unique ID from a URL parameter
219(1)
Passing the data from the API to the view
220(1)
Debugging and fixing the view errors
221(2)
Creating status-specific error pages
223(3)
7.4 Adding data to the database via the API: Add Loc8r reviews
226(128)
Setting up the routing and views
227(4)
POSTing the review data to the API
231(123)
11.2 Creating a user schema for MongoDB
354(6)
One-way password encryption: Hashes and salts
354(1)
Building the Mongoose schema
354(1)
Setting encrypted paths using Mongoose methods
355(2)
Validating a submitted password
357(1)
Generating a JSON Web Token
357(3)
11.3 Creating an authentication API with Passport
360(8)
Installing and configuring Passport
360(3)
Creating API endpoints to return JSON Web Tokens
363(5)
11.4 Securing relevant API endpoints
368(5)
Adding authentication middleware to Express routes
368(1)
Using the JWT information inside a controller
369(4)
11.5 Creating Angular authentication service
373(4)
Managing a user session in Angular
373(1)
Allowing users to sign up, sign in, and sign out
374(1)
Using the JWT data in the Angular service
375(2)
11.6 Creating register and login pages
377(6)
Building the register page
377(3)
Building the login page
380(3)
11.7 Working with authentication in the Angular app
383(6)
Updating navigation
383(3)
Adding user data to a review
386(3)
11.8 Summary
389(2)
Appendix A Installing the stack 391(4)
Appendix B Installing and preparing the supporting cast 395(4)
Appendix C Dealing with all of the views 399(6)
Appendix D Reintroducing JavaScript available online only index 405
Simon Holmes has been a full stack developer since the late '90s, integrating a variety of front-end and back-end technologies. He is part of the Technical Solutions team at LivePerson, developing new components and meeting technology integration requests from enterprise clients.