Express.js Guide
Express.js Guide
The Comprehensive Book on Express.js
About the Book
The Comprehensive Book on Express.js
The in-depth, detailed, hand-on manual on Express.js, the most popular Node.js framework. Will get you up and running fast and save you time. Understand the concepts, learn the best practices. Become an Express.js expert today.
Express.js API reference, quick start guides, 20+ meticulously explained examples and tutorials — over 270 pages with more than 60 illustrations.
Get the full package and the print book from http://expressjsguide.com.
Buy Express.js Guide on Leanpub for $14.87 or read this and four other JavaScript and Node.js books for $4.87/mo on AnyWhereLib.com.
Table of Contents
-
- Foreword
- Acknowledgment
-
Introduction
- Why
- What This Book Is
- What This Book is Not
- Who This Book is For
- Notation
- Navigation
- How to Use the Book
- Examples
- About the Author
- Errata
- Contact Us
-
I Quick Start
- 1. What is Express.js?
- 2. How Express.js Works
- 3. Installation
- 4. Hello World Example
- 5. CLI
- 6. Watching for File Changes
- 7. MVC Structure and Modules
-
II The Interface
-
8. Configuration
- 8.1 app.set() and app.get()
- 8.2 app.enable() and app.disable()
- 8.3 app.enabled() and app.disabled()
-
9. Settings
- 9.1 env
- 9.2 view cache
- 9.3 view engine
- 9.4 views
- 9.5 trust proxy
- 9.6 jsonp callback name
- 9.7 json replacer and json spaces
- 9.8 case sensitive routing
- 9.9 strict routing
- 9.10 x-powered-by
- 9.11 etag
- 9.12 subdomain offset
-
10. Environments
- 10.1 app.configure()
-
11. Applying Middleware
- 11.1 app.use()
-
12. Types of Middleware
- 12.1 express.compress()
- 12.2 express.logger()
- 12.3 express.json()
- 12.4 express.urlencoded()
- 12.5 express.multipart()
- 12.6 express.bodyParser()
- 12.7 express.cookieParser()
- 12.8 express.session()
- 12.9 express.csrf()
- 12.10 express.static()
- 12.11 express.basicAuth()
- 12.12 Other Express.js/Connect Middlewares
-
13. Different Template Engines
- 13.1 app.engine()
-
14. Extracting Parameters
- 14.1 app.param()
-
15. Routing
- 15.1 app.VERB()
- 15.2 app.all()
- 15.3 Trailing Slashes
- 16. Request Handlers
-
17. Request
- 17.1 query
- 17.2 req.params
- 17.3 req.body
- 17.4 req.files
- 17.5 req.route
- 17.6 req.cookies
- 17.7 req.signedCookies
- 17.8 req.header() and req.get()
- 17.9 Other Attributes and Methods
-
18. Response
- 18.1 res.render()
- 18.2 res.locals()
- 18.3 res.set()
- 18.4 res.status()
- 18.5 res.send()
- 18.6 res.json()
- 18.7 res.jsonp()
- 18.8 res.redirect()
- 18.9 Other Response Methods and Properties
- 19. Error Handling
-
20. Running an App
- 20.1 app.locals
- 20.2 app.render()
- 20.3 app.routes
- 20.4 app.listen()
-
8. Configuration
-
III Tips and Tricks
- 21. Abstraction
- 22. Using Databases in Modules
- 23. Keys and Passwords
- 24. Streams
- 25. Redis
- 26. Authentication
- 27. Multi-Threading with Clusters
- 28. Consolidate.js
-
29. Stylus, LESS and SASS
- 29.1 Stylus
- 29.2 LESS
- 29.3 SASS
-
30. Security
- 30.1 CSRF
- 30.2 Permissions
- 30.3 Headers
- 31. Socket.IO
- 32. Domains
-
IV Tutorials and Examples
-
33. Instagram Gallery
- 33.1 A File Structure
- 33.2 Dependencies
- 33.3 Node.js Server
- 33.4 Handlebars Template
- 33.5 Conclusion
-
34. Todo App
- 34.1 Scaffolding
- 34.2 MongoDB
- 34.3 Structure
- 34.4 app.js
- 34.5 Routes
- 34.6 Jades
- 34.7 LESS
- 34.8 Conclusion
-
35. REST API
- 35.1 Test Coverage
- 35.2 Dependencies
- 35.3 Implementation
- 35.4 Conclusion
-
36. HackHall
- 36.1 What is HackHall
- 36.2 Running HackHall
- 36.3 Structure
- 36.4 Express.js App
-
36.5 Routes
- 36.5.1 index.js
- 36.5.2 auth.js
- 36.5.3 main.js
- 36.5.4 users.js
- 36.5.5 applications.js
- 36.5.6 posts.js
- 36.6 Mogoose Models
- 36.7 Mocha Tests
- 36.8 Conclusion
-
ExpressWorks
- What is ExpressWorks Based On?
- Installation (recommended)
- Local Installation (advanced)
- Usage
- Reset
-
Steps
- Hello World
- Jade
- Good Old Form
- Static
- Stylish CSS
- Param Pam Pam
- What’s in a Query
- JSON Me
-
Related Reading and Resources
- Other Node.js Frameworks
- Node.js Books
- JavaScript Classics
- Contact Us
-
Appendix A: Migrating Express.js 3.x to 4.x: Middleware, Route and Other Changes
- Replacing Unbundled Middleware in Express.js 4
-
Removing Deprecated Methods from Express.js 4 Apps
- app.configure()
- app.router
- res.on(‘header’)
- res.charset
- res.headerSent
- req.accepted()
-
Other Express.js 4 Changes
- app.use()
- res.location()
- app.route
- json spaces
- req.params
- res.locals
- req.is
- Express.js Command-Line Generator
- Express.js 4 Route Instance and Chaining It
- Further Express.js 4 Migration Reading Links
-
Appendix B: Express.js 4, Node.js and MongoDB REST API Tutorial
- Node.js and MongoDB REST API Overview
- REST API Tests with Mocha and Superagent
- NPM-ing Node.js Server Dependencies
- Express.js 4 and MongoDB (Mongoskin) Implementation
- Running The Express.js 4 App and Testing MongoDB Data with Mocha
- Conclusion and Further Express.js and Node.js Reading
-
Appendix C: Express.js 4 Cheatsheet
- Installation
- Generator
- Basics
- HTTP Verbs and Routes
- Request
- Request Header Shortcuts
- Response
- Handlers Signatures
- Stylus and Jade
- Body
- Static
- Connect Middleware
- Other Popular Middleware
-
33. Instagram Gallery
Other books by this author
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them