وبلاگ بلیان

Web Development with Node and Express : Leveraging the JavaScript Stack

معرفی کتاب «Web Development with Node and Express : Leveraging the JavaScript Stack» نوشتهٔ Ethan Brown، منتشرشده توسط نشر O'Reilly Media در سال 2019. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است. «Web Development with Node and Express : Leveraging the JavaScript Stack» در دستهٔ بدون دسته‌بندی قرار دارد.

Build dynamic web applications with Express, a key component of the Node/JavaScript development stack. In this updated edition, author Ethan Brown teaches you Express fundamentals by walking you through the development of an example application. This hands-on guide covers everything from server-side rendering to API development suitable for usein single-page apps (SPAs). Express strikes a balance between a robust framework and no framework at all, allowing you a free hand in your architecture choices. Frontend and backend engineers familiar with JavaScript will also learn best practices for building multipage and hybrid web apps with Express. Pick up this book anddiscover new ways to look at web development. * Create a templating system for rendering dynamic data * Dive into request and response objects, middleware, and URL routing * Simulate a production environment for testing * Persist data in document databases with MongoDB and relational databases with PostgreSQL * Make your resources available to other programs with APIs * Build secure apps with authentication, authorization, and HTTPS * Integrate with social media, geolocation, and more * Implement a plan for launching and maintaining your app * Learn critical debugging skills Cover 1 Web Development with Node and Express 3 Table of Contents 7 Preface 15 1 Introducing Express 23 The JavaScript Revolution 23 Introducing Express 25 Server-Side and Client-Side Applications 26 A Brief History of Express 27 Node: A New Kind of Web Server 27 The Node Ecosystem 29 Licensing 30 Conclusion 31 2 Getting Started with Node 33 Getting Node 33 Using the Terminal 34 Editors 35 npm 36 A Simple Web Server with Node 37 Hello World 37 Event-Driven Programming 38 Routing 39 Serving Static Resources 40 Onward to Express 42 3 Saving Time with Express 43 Scaffolding 43 The Meadowlark Travel Website 44 Initial Steps 44 Views and Layouts 48 Static Files and Views 51 Dynamic Content in Views 52 Conclusion 52 4 Tidying Up 53 File and Directory Structure 53 Best Practices 54 Version Control 54 How to Use Git with This Book 55 If You’re Following Along by Doing It Yourself 55 If You’re Following Along by Using the Official Repository 56 npm Packages 58 Project Metadata 59 Node Modules 59 Conclusion 61 5 Quality Assurance 63 The QA Plan 64 QA: Is It Worth It? 65 Logic Versus Presentation 66 The Types of Tests 67 Overview of QA Techniques 67 Installing and Configuring Jest 67 Unit Testing 68 Mocking 69 Refactoring the Application for Testability 69 Writing Our First Test 70 Test Maintenance 72 Code Coverage 72 Integration Testing 73 Linting 76 Continuous Integration 80 Conclusion 80 6 The Request and Response Objects 81 The Parts of a URL 81 HTTP Request Methods 83 Request Headers 83 Response Headers 84 Internet Media Types 84 Request Body 85 The Request Object 85 The Response Object 87 Getting More Information 89 Boiling It Down 90 Rendering Content 90 Processing Forms 91 Providing an API 92 Conclusion 94 7 Templating with Handlebars 95 There Are No Absolute Rules Except This One 97 Choosing a Template Engine 97 Pug: A Different Approach 98 Handlebars Basics 99 Comments 100 Blocks 100 Server-Side Templates 102 Views and Layouts 103 Using Layouts (or Not) in Express 104 Sections 105 Partials 107 Perfecting Your Templates 109 Conclusion 110 8 Form Handling 111 Sending Client Data to the Server 111 HTML Forms 112 Encoding 113 Different Approaches to Form Handling 113 Form Handling with Express 115 Using Fetch to Send Form Data 117 File Uploads 119 File Uploads with Fetch 121 Improving File Upload UI 122 Conclusion 122 9 Cookies and Sessions 125 Externalizing Credentials 127 Cookies in Express 128 Examining Cookies 129 Sessions 129 Memory Stores 130 Using Sessions 131 Using Sessions to Implement Flash Messages 132 What to Use Sessions For 134 Conclusion 134 10 Middleware 135 Middleware Principles 136 Middleware Examples 137 Common Middleware 140 Third-Party Middleware 142 Conclusion 142 11 Sending Email 143 SMTP, MSAs, and MTAs 143 Receiving Email 144 Email Headers 144 Email Formats 145 HTML Email 145 Nodemailer 146 Sending Mail 147 Sending Mail to Multiple Recipients 148 Better Options for Bulk Email 149 Sending HTML Email 149 Images in HTML Email 149 Using Views to Send HTML Email 150 Encapsulating Email Functionality 152 Conclusion 153 12 Production Concerns 155 Execution Environments 155 Environment-Specific Configuration 156 Running Your Node Process 158 Scaling Your Website 159 Scaling Out with App Clusters 160 Handling Uncaught Exceptions 162 Scaling Out with Multiple Servers 164 Monitoring Your Website 165 Third-Party Uptime Monitors 165 Stress Testing 165 Conclusion 167 13 Persistence 169 Filesystem Persistence 169 Cloud Persistence 171 Database Persistence 172 A Note on Performance 173 Abstracting the Database Layer 173 Setting Up MongoDBThe difficulty involved 175 Mongoose 176 Database Connections with Mongoose 176 Creating Schemas and Models 177 Seeding Initial Data 178 Retrieving Data 180 Adding Data 182 PostgreSQL 184 Adding Data 190 Using a Database for Session Storage 191 Conclusion 194 14 Routing 195 Routes and SEO 197 Subdomains 197 Route Handlers Are Middleware 199 Route Paths and Regular Expressions 200 Route Parameters 201 Organizing Routes 202 Declaring Routes in a Module 203 Grouping Handlers Logically 204 Automatically Rendering Views 205 Conclusion 206 15 REST APIs and JSON 207 JSON and XML 208 Our API 208 API Error Reporting 209 Cross-Origin Resource Sharing 210 Our Tests 211 Using Express to Provide an API 213 Conclusion 214 16 Single-Page Applications 215 A Short History of Web Application Development 215 SPA Technologies 218 Creating a React App 219 React Basics 220 The Home Page 222 Routing 223 Vacations Page—Visual Design 226 Sending Information to the Server 230 State Management 232 Deployment Options 234 Conclusion 234 17 Static Content 237 Performance Considerations 238 Content Delivery Networks 239 Designing for CDNs 240 Server-Rendered Website 240 Single-Page Applications 241 Caching Static Assets 241 Changing Your Static Content 242 Conclusion 243 18 Security 245 HTTPS 245 Generating Your Own Certificate 246 Using a Free Certificate Authority 247 Purchasing a Certificate 248 Enabling HTTPS for Your Express App 250 A Note on Ports 251 HTTPS and Proxies 252 Cross-Site Request Forgery 253 Authentication 254 Authentication Versus Authorization 254 The Problem with Passwords 255 Third-Party Authentication 256 Storing Users in Your Database 256 Authentication Versus Registration and the User Experience 258 Passport 258 Role-Based Authorization 268 Adding Authentication Providers 269 Conclusion 270 19 Integrating with Third-Party APIs 271 Social Media 271 Social Media Plugins and Site Performance 271 Searching for Tweets 272 Rendering Tweets 275 Geocoding 278 Geocoding with Google 278 Geocoding Your Data 280 Displaying a Map 282 Weather Data 283 Conclusion 285 20 Debugging 287 The First Principle of Debugging 287 Take Advantage of REPL and the Console 288 Using Node’s Built-in Debugger 289 Node Inspector Clients 290 Debugging Asynchronous Functions 294 Debugging Express 294 Conclusion 297 21 Going Live 299 Domain Registration and Hosting 299 Domain Name System 300 Security 301 Top-Level Domains 301 Subdomains 302 Nameservers 303 Hosting 305 Deployment 307 Conclusion 310 22 Maintenance 313 The Principles of Maintenance 313 Have a Longevity Plan 313 Use Source Control 315 Use an Issue Tracker 315 Exercise Good Hygiene 316 Don’t Procrastinate 316 Do Routine QA Checks 316 Monitor Analytics 317 Optimize Performance 317 Prioritize Lead Tracking 318 Prevent “Invisible” Failures 319 Code Reuse and Refactoring 320 Private npm Registry 320 Middleware 320 Conclusion 322 23 Additional Resources 323 Online Documentation 323 Periodicals 324 Stack Overflow 324 Contributing to Express 326 Conclusion 328 Index 329 "Build dynamic web applications with Express, a key component of the Node/JavaScript development stack. In this updated edition, author Ethan Brown teaches you Express fundamentals by walking you through the development of an example application. This hands-on guide covers everything from server-side rendering to API development suitable for usein single-page apps (SPAs). Express strikes a balance between a robust framework and no framework at all, allowing you a free hand in your architecture choices. Frontend and backend engineers familiar with JavaScript will also learn best practices for building multipage and hybrid web apps with Express. Pick up this book and discover new ways to look at web development."--Amazon.com
دانلود کتاب Web Development with Node and Express : Leveraging the JavaScript Stack