Download Complete Web Development with Node and Express Leveraging the JavaScript Stack 2nd Edition Ethan Brown PDF for All Chapters
Download Complete Web Development with Node and Express Leveraging the JavaScript Stack 2nd Edition Ethan Brown PDF for All Chapters
com
https://textbookfull.com/product/web-development-with-node-
and-express-leveraging-the-javascript-stack-2nd-edition-
ethan-brown/
OR CLICK BUTTON
DOWNLOAD NOW
Pro MERN Stack: Full Stack Web App Development with Mongo,
Express, React, and Node 2nd Edition Vasan Subramanian
https://textbookfull.com/product/pro-mern-stack-full-stack-web-app-
development-with-mongo-express-react-and-node-2nd-edition-vasan-
subramanian/
textboxfull.com
Pro MERN Stack: Full Stack Web App Development with Mongo,
Express, React, and Node Vasan Subramanian
https://textbookfull.com/product/pro-mern-stack-full-stack-web-app-
development-with-mongo-express-react-and-node-vasan-subramanian/
textboxfull.com
Pro MERN Stack: Full Stack Web App Development with Mongo,
Express, React, and Node 1st Edition Vasan Subramanian
(Auth.)
https://textbookfull.com/product/pro-mern-stack-full-stack-web-app-
development-with-mongo-express-react-and-node-1st-edition-vasan-
subramanian-auth/
textboxfull.com
https://textbookfull.com/product/full-stack-react-projects-modern-web-
development-using-react-16-node-express-and-mongodb-2nd-edition-shama-
hoque/
textboxfull.com
Learning JavaScript 3rd Edition Ethan Brown
https://textbookfull.com/product/learning-javascript-3rd-edition-
ethan-brown/
textboxfull.com
https://textbookfull.com/product/pro-express-js-master-express-js-the-
node-js-framework-for-your-web-development-mardan-azat/
textboxfull.com
https://textbookfull.com/product/programming-web-applications-with-
node-express-and-pug-1st-edition-jorg-krause-auth/
textboxfull.com
https://textbookfull.com/product/full-stack-javascript-learn-backbone-
js-node-js-and-mongodb-mardan-azat/
textboxfull.com
1. Preface
2. 1. Introducing Express
a. Getting Node
b. Using the Terminal
c. Editors
d. npm
e. A Simple Web Server with Node
i. Hello World
ii. Event-Driven Programming
iii. Routing
iv. Serving Static Resources
f. Onward to Express
a. Scaffolding
b. The Meadowlark Travel Website
c. Initial Steps
e. npm Packages
f. Project Metadata
g. Node Modules
h. Conclusion
6. 5. Quality Assurance
a. The QA Plan
b. QA: Is It Worth It?
c. Logic Versus Presentation
d. The Types of Tests
e. Overview of QA Techniques
f. Installing and Configuring Jest
g. Unit Testing
i. Mocking
ii. Refactoring the Application for Testability
iii. Writing Our First Test
iv. Test Maintenance
v. Code Coverage
h. Integration Testing
i. Linting
j. Continuous Integration
k. Conclusion
i. Rendering Content
ii. Processing Forms
iii. Providing an API
k. Conclusion
e. Conclusion
9. 8. Form Handling
a. Externalizing Credentials
b. Cookies in Express
c. Examining Cookies
d. Sessions
i. Memory Stores
ii. Using Sessions
e. Using Sessions to Implement Flash Messages
f. What to Use Sessions For
g. Conclusion
a. Middleware Principles
b. Middleware Examples
c. Common Middleware
d. Third-Party Middleware
e. Conclusion
i. Sending Mail
ii. Sending Mail to Multiple Recipients
g. Better Options for Bulk Email
h. Sending HTML Email
i. Images in HTML Email
ii. Using Views to Send HTML Email
iii. Encapsulating Email Functionality
i. Conclusion
a. Execution Environments
b. Environment-Specific Configuration
c. Running Your Node Process
d. Scaling Your Website
f. Stress Testing
g. Conclusion
a. Filesystem Persistence
b. Cloud Persistence
c. Database Persistence
i. A Note on Performance
ii. Abstracting the Database Layer
iii. Setting Up MongoDB
iv. Mongoose
v. Database Connections with Mongoose
vi. Creating Schemas and Models
vii. Seeding Initial Data
viii. Retrieving Data
ix. Adding Data
x. PostgreSQL
xi. Adding Data
d. Using a Database for Session Storage
e. Conclusion
a. HTTPS
d. Conclusion
20. 19. Integrating with Third-Party APIs
a. Social Media
b. Geocoding
c. Weather Data
d. Conclusion
21. 20. Debugging
b. Conclusion
23. 22. Maintenance
25. Index
Web Development with
Node and Express
Leveraging the JavaScript Stack
SECOND EDITION
Ethan Brown
Web Development with Node and Express
by Ethan Brown
The views expressed in this work are those of the author, and do not
represent the publisher’s views. While the publisher and the author have
used good faith efforts to ensure that the information and instructions
contained in this work are accurate, the publisher and the author disclaim
all responsibility for errors or omissions, including without limitation
responsibility for damages resulting from the use of or reliance on this
work. Use of the information and instructions contained in this work is at
your own risk. If any code samples or other technology this work contains
or describes is subject to open source licenses or the intellectual property
rights of others, it is your responsibility to ensure that your use thereof
complies with such licenses and/or rights.
978-1-492-05351-4
[LSI]
Dedication
Then, of course, there are the programmers like me, who have been
around for a while. Like many programmers of my era, I started off with
assembler and BASIC and went through Pascal, C++, Perl, Java, PHP,
Ruby, C, C#, and JavaScript. At university, I was exposed to more niche
languages such as ML, LISP, and PROLOG. Many of these languages are
near and dear to my heart, but in none of these languages do I see so much
promise as I do in JavaScript. So I am also writing this book for
programmers like myself, who have a lot of experience and perhaps a
more philosophical outlook on specific technologies.
Most important, this book is for programmers who are excited. Excited
about the future of the internet and want to be part of it. Excited about
learning new things, new techniques, and new ways of looking at web
development. If, dear reader, you are not excited, I hope you will be by the
time you reach the end of this book….
Chapter 5 discusses testing and QA, and Chapter 6 covers some of Node’s
more important constructs and how they are extended and used by
Express. Chapter 7 covers templating (using Handlebars), which lays the
foundation of building useful websites with Express. Chapter 8 and
Chapter 9 cover cookies, sessions, and form handlers, rounding out the
things you need to know to build basic functional websites with Express.
Chapter 14 gets into the details of routing with Express (how URLs are
mapped to content), and Chapter 15 takes a diversion into writing APIs
with Express. Chapter 17 covers the details of serving static content, with
a focus on maximizing performance.
Chapter 16 takes what we’ve learned about Express and uses it to refactor
the running example as an SPA, with Express as the backend server
providing the API we created in Chapter 15.
Chapter 20 and Chapter 21 get you ready for the big day: your site launch.
They cover debugging, so you can root out any defects before launch, and
the process of going live. Chapter 22 talks about the next important (and
oft-neglected) phase: maintenance.
The book concludes with Chapter 23, which points you to additional
resources, should you want to further your education about Node and
Express, and where you can go to get help.
Example Website
Starting in Chapter 3, a running example will be used throughout the
book: the Meadowlark Travel website. I wrote the first edition just after
getting back from a trip to Lisbon, and I had travel on my mind, so the
example website I chose is for a fictional travel company in my home state
of Oregon (the Western Meadowlark is the state songbird of Oregon).
Meadowlark Travel allows travelers to connect to local “amateur tour
guides,” and it partners with companies offering bike and scooter rentals
and local tours, with a focus on ecotourism.
Italic
Indicates new terms, URLs, email addresses, filenames, and file
extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to
program elements such as variable or function names, databases, data
types, environment variables, statements, and keywords.
Constant width bold
Shows commands or other text that should be typed literally by the
user.
Constant width italic
Shows text that should be replaced with user-supplied values or by
values determined by context.
TIP
This element signifies a tip or suggestion.
NOTE
This element signifies a general note.
WARNING
This element indicates a warning or caution.
This book is here to help you get your job done. In general, if example
code is offered with this book, you may use it in your programs and
documentation. You do not need to contact us for permission unless
you’re reproducing a significant portion of the code. For example, writing
a program that uses several chunks of code from this book does not
require permission. Selling or distributing a CD-ROM of examples from
O’Reilly books does require permission. Answering a question by citing
this book and quoting example code does not require permission.
Incorporating a significant amount of example code from this book into
your product’s documentation does require permission.
If you feel your use of code examples falls outside fair use or the
permission given here, feel free to contact us at permissions@oreilly.com.
NOTE
For almost 40 years, O’Reilly Media has provided technology and business training, knowledge,
and insight to help companies succeed.
Our unique network of experts and innovators share their knowledge and
expertise through books, articles, conferences, and our online learning
platform. O’Reilly’s online learning platform gives you on-demand access
to live training courses, in-depth learning paths, interactive coding
environments, and a vast collection of text and video from O’Reilly and
200+ other publishers. For more information, please visit
http://oreilly.com.
How to Contact Us
How to Contact Us
Please address comments and questions concerning this book to the
publisher:
Sebastopol, CA 95472
707-829-0104 (fax)
We have a web page for this book, where we list errata, examples, and any
additional information. You can access this page at
https://oreil.ly/web_dev_node_express_2e.
For more information about our books, courses, conferences, and news,
see our website at http://www.oreilly.com.
Acknowledgments
Acknowledgments
So many people in my life have played a part in making this book a
reality; it would not have been possible without the influence of all the
people who have touched my life and made me who I am today.
I would like to start out by thanking everyone at Pop Art: not only has my
time at Pop Art given me a renewed passion for engineering, but I have
learned so much from everyone there, and without their support, this book
would not exist. I am grateful to Steve Rosenbaum for creating an
inspiring place to work, and to Del Olds for bringing me on board, making
me feel welcome, and being an honorable leader. Thanks to Paul Inman
for his unwavering support and inspiring attitude toward engineering, and
Tony Alferez for his warm support and for helping me carve out time for
writing without impacting Pop Art. Finally, thanks to all the great
engineers I have worked with, who keep me on my toes: John Skelton,
Dylan Hallstrom, Greg Yung, Quinn Michaels, CJ Stritzel, Colwyn Fritze-
Moor, Diana Holland, Sam Wilskey, Cory Buckley, and Damion Moyer.
Zach Mason, thank you for being an inspiration to me. This book may be
no The Lost Books of the Odyssey, but it is mine, and I don’t know if I
would have been so bold without your example.
Elizabeth and Ezra, thank you for the gifts you both gave me. I will love
you both forever.
Many thanks to Simon St. Laurent for giving me this opportunity, and to
Angela Rufino (second edition) and Brian Anderson (first edition) for their
steady and encouraging editing. Thanks to everyone at O’Reilly for their
dedication and passion. Thanks to Alejandra Olvera-Novack, Chetan
Karande, Brian Sletten, Tamas Piros, Jennifer Pierce, Mike Wilson, Ray
Villalobos, and Eric Elliot for their thorough and constructive technical
reviews.
Katy Roberts and Hanna Nelson provided invaluable feedback and advice
on my “over the transom” proposal that made this book possible. Thank
you both so much! Thanks to Chris Cowell-Shah for his excellent
feedback on the QA chapter.
Lastly, thanks to my dear friends, without whom I surely would have gone
Another Random Scribd Document
with Unrelated Content
*** END OF THE PROJECT GUTENBERG EBOOK
AARTEENKAIVAJAT ***
Updated editions will replace the previous one—the old editions will
be renamed.
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the terms
of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.
• You pay a royalty fee of 20% of the gross profits you derive from
the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
1.F.4. Except for the limited right of replacement or refund set forth in
paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
textbookfull.com