ebook img

Express in Action: Writing, building, and testing Node.js applications PDF

403 Pages·2016·3.03 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Express in Action: Writing, building, and testing Node.js applications

MEAP Edition Manning Early Access Program Express in Action Node applications with Express and its companion tools Version 10 Copyright 2015 Manning Publications ©Manning Publications Co. We welcome reader comments about anything in the manuscript - other than typos and other simple mistakes. These will be cleaned up during production of the book by copyeditors and proofreaders. https://forums.manning.com/forums/express-in-action For more information on this and other Manning titles go to www.manning.com welcome Thank you so much for purchasing the MEAP for Express in Action! The book is really coming along, and I'm honored that you'll join me as I continue to work on it. This is an intermediate- level book aimed at intermediate-level JavaScript developers who want to start building web applications with Express and Node.js. I've tried to make the content approachable to Node.js beginners. I want to emphasize how Express works, not just how to use it; I find this thinking invaluable when debugging and when deciding how to architect my software. I also hope to show how to extend Express with other tools to build rich web applications. In this MEAP, we've got seven chapters of the planned eleven and an appendix. The first chapter outlines Express at a high level, and is aptly- named "What is Express?". It explains what the Express framework is and isn't, its strengths and weaknesses, and its major conceptual hurdles. Chapter 2 aims to give you a solid understanding of Express's foundations. It starts by focusing on low-level Node.js, and then transitions to showing how to do the same things with Express at a higher level. By the end of the chapter, you'll have a strong understanding of the framework which we'll build on for the rest understanding of the framework which we'll build on for the rest of the book. Chapter 4 digs into routing, which is one of Express's major features. Routing allows Express to appropriately sort requests coming into your website. The chapter starts with basic examples but gets in-depth. If any of the basic web workings confuse you, you can take a look at the appendix that describes HTTP in detail. Chapter 5 talks about dynamically-generated HTML templates. We'll try both EJS and Jade, two popular templating engines for Node. Chapter 6 is a chapter about databases. There are very few web applications that can function without some kind of data storage, and this chapter tackles that with the MongoDB database, a popular choice for Express developers. Chapter 8 will have you setting up automated testing for your Express applications. After you write automated tests, you'll be much more confident that your code is robust and performing as it should. We'll look at some of the helpful tools out there. Chapter 10 takes your applications to the real world—you'll deploy your applications to the Heroku cloud platform. You'll be able to write Express applications and show them to the world. This chapter also discusses compilation of assets, which includes the packaging of JavaScript and CSS to speed up your client-side resources. Future chapters will discuss middleware in detail, how to secure Express applications, techniques for building APIs, and how to integrate Express with databases and real-time features. I really hope you'll continue to give feedback in the Author Online forum. I'll be reading and responding to all of your comments, and your feedback is very helpful as I work on this book! Thanks again! Honored that you'd join me on this journey. —Evan Hahn brief contents Part 1: Introduction 1 What is Express? 2 The Basics of Node.js 3 Foundations of Express Part 2: Core Express 4 Middleware 5 Routing 6 Building APIs Part 3: Express in Context 7 Views & Templates : Jade & EJS 8 Persisting your data with MongoDB 9 Testing Express Applications 10 Security 11 Deployment: Assets & Heroku 12 Best practices Appendixes: A Other Helpful Modules 1 What is Express? Before we talk about Express, we need to talk about Node.js. For most of its life, the JavaScript programming language has lived inside of web browsers. It started as a simple scripting language for modifying small details of webpages, but grew into a complex language, with loads of applications and libraries. Many browser vendors like Mozilla and Google began to pump lots of resources into fast JavaScript runtimes, and Google Chrome and Mozilla Firefox got much faster JavaScript engines as a result. In 2009, Node.js came around. Node took V8, Google Chrome's powerful JavaScript engine, out of the browser and made it able to run on servers. In the browser, developers had no choice but to choose JavaScript. In addition to Ruby, Python, C#, Java, or other languages, developers could now choose JavaScript when developing server-side applications. JavaScript might not be the perfect language for everyone, but Node.js had some real benefits. For one, the V8 JavaScript engine is fast, and Node encourages an asynchronous coding style, making for faster code while avoiding multi-threaded nightmares. JavaScript also had a bevy of useful libraries because of its popularity. But the biggest benefit of Node.js is the ability to share code between browser and server. Developers don't have to do any kind of context switch when switching between client and server. Now they can use the same code and the same coding paradigms between two same code and the same coding paradigms between two different JavaScript runtimes; the browser and the server. Node.js caught on—people thought it was pretty cool. Like browser-based JavaScript, Node.js provides a bevy of low- level features you'd need to build an application. But like browser-based JavaScript, its low-level offerins can be a bit verbose and difficult. Enter Express.js. Express is a framework that acts as light layer on top of the Node.js web server, making it more pleasant to develop Node.js web applications. Express.js is philosophically similar to jQuery. People want to add dynamic content to their webpages, but the “vanilla” browser APIs can be verbose, confusing, and limited in features. Developers often have to write a lot of boilerplate code. jQuery exists to cut down on this boilerplate code by simplifying the APIs of the browser and adding helpful new features. That's basically it. Express is exactly the same. People want to make web applications with Node.js, but the “vanilla” Node.js APIs can be verbose, confusing, and limited in features. Developers often have to write a lot of boilerplate code. Express exists to cut down on this boilerplate code by simplifying the APIs of Node.js and adding helpful new features. That's basically it! Like jQuery, Express aims to be extensible. It's hands-off about most parts of your applications' decisions and is easily extended with third-party libraries. Throughout this book and your Express career, you'll have to make decisions about your applications' architectures and you'll extend Express with a bevy of powerful

Description:
Summary Express in Action is a carefully designed tutorial that teaches you how to build web applications using Node and Express. Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications. About the Technology Express.js is a web application framewor
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.