售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Express Web Application Development
Table of Contents
Express Web Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Downloading the example code
Customer support
Errata
Piracy
Questions
1. What is Express?
What is Express?
The story of Express
Installing Express
The stuff that makes up Express
The application object
The request object
The response object
Concepts used in Express
Asynchronous JavaScript
Node modules
Express apps are Node modules
Middlewares
Request flow
Node HTTP/HTTPS API
Summary
2. Your First Express App
Your first Express app
The Express manifest file
A very basic Express app
Starting and stopping the app
Analyzing the output
Express app with views
A public directory for the app
Auto-generating an Express app
Empowering Express with middlewares
Empowering Express with Node modules
Logging requests to the App
Using a configuration file
Setting and getting application options
Express in different environments
Summary
3. Understanding Express Routes
What are Routes?
A quick introduction to HTTP verbs
Revisiting the router middleware
Defining routes for the app
Route identifiers
Order of route precedence
How to handle routes
How to organize routes
Using Node modules
Namespaced routing
Resourceful routing
Making a choice
Summary
4. Response From the Server
A primer on HTTP response
HTTP status codes
1xx
2xx
3xx
4xx
5xx
HTTP response headers
Media types
HTTP response in Express
Setting the HTTP status code
Setting HTTP headers
Sending data
Plain text
HTML
JSON
JSONP
Serving static files
Serving files programmatically
Serving error pages
Content negotiation
Redirecting a request
Summary
5. The Jade Templating Language
What is Jade?
Generating HTML tags
Hierarchy of HTML elements
Assigning IDs
Assigning classes
Specifying HTML attributes
Creating text content
Filters
Declaring the document's Doctype
Programmability in Jade
Variables
Interpolation
Control structures
JavaScript constructs
Jade constructs
if, else if, and else
for
each
while
unless
case
Modularization
Includes
Template inheritance
Mixins
Escaping
Comments
Summary
6. The Stylus CSS Preprocessor
Introduction
Enabling Stylus in Express
Selectors
Selector blocks
Hierarchy
Rules
@import
@media
@font-face
@keyframes
@extend
@css
Programmability
Variables
Literals
Lists
Tuples
Listed tuples
Mixins
Functions
Comments
Operators
Conditionals
if, else if, and else
unless
Built-in functions
Summary
7. Forms, Cookies, and Sessions
Using forms to submit data
Handling GET submissions
Reading form data
Reading URL query parameters
Handling multiple options
Handling POST submissions
Enabling POST data parsing
Reading form data
Handling text-only forms
Handling file uploads
More about file uploads
Submission via simulated methods
Data in named segments
Reading data
Using cookies to store data
Creating cookies
Reading cookies
Updating cookies
Session cookies
Signed cookies
Deleting cookies
Using sessions to store data
Cookie-based sessions
Session store-based sessions
MemoryStore
RedisStore
MongoStore
Session variables
Setting session variables
Reading session variables
Updating session variables
Deleting session variables
Deleting a session
Deleting a cookie-based session
Deleting a session store-based session
Summary
8. Express in Production
What the is production environment?
What changes in production mode?
Simulating production environment
Benchmarking the app
Creating an app cluster
Handling critical events
Closing the server
Handling uncaught errors
Using try-catch to catch uncaught errors
Using domains to handle uncaught errors
What to do in case of uncaught errors – to terminate the process or not to terminate?
Handling process termination
Ensuring uptime
Forever
Upstart
Using a reverse proxy
The trust proxy option
Summary
Index
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜