Index
A
- & (ampersand) / Looking at the execution flow using logs
- .authenticate(). function / Post and User models
- ab (Apache Benchmark) / Load testing
- after module
- URL /
- API
- versioning / API versioning
- rate limiting / API rate limiting
- API rate limiting / API rate limiting
- API versioning / API versioning
- app.use() method / The functionality of middleware, Adding the routes handler
- app.VERB() function / Reusable route handlers, Ordering of middleware
- application
- running / Running the application
- application, for time display in current time zone
- application, middleware system replication
- demoing / Demonstrating the application
- application-level data /
- application entry point
- creating / Creating the application entry point
- application monitoring
- improving, tips / Simple tips for improving the application monitoring
- application structure
- about / The application structure
- files, grouping by feature / Group files by features
- Model-View-Controller (MVC) / Model-View-Controller
- application structure, MovieApp sample application /
- application uptime
- ensuring / Ensuring the application uptime
- mon tool / Ensuring the application uptime
- forever tool / Ensuring the application uptime
- monit tool / Ensuring the application uptime
- asset versioning
- about / Asset versioning
- async-each module
- async-series module
- URL /
- authbind
- automated tests
- need for / The importance of having automated tests
- average function response time
- measuring / Measuring the average function response time
B
- backend improvements
- about / Backend improvements
- synchronous functions, avoiding / Avoiding synchronous functions
- queries, executing in parallel / Doing things in parallel whenever possible
- data processing, with streams / Using streams to process data
- templates, streaming with trumpet module / Streaming templates with trumpet
- dynamic data, caching / Caching dynamic data
- concurrent connections, handling with cluster / Using a cluster to handle more concurrent connections
- HTTPS, using with Stud / HTTPS with Stud
- bad use cases / Bad use cases
- bitwise operators
- URL / API rate limiting
- Blanket.js
- URL / Code coverage
- bootstrapping phase
- about / The bootstrapping phase
- buggy application, V8 debugger
- endpoints / Creating our buggy application
- creating / Creating our buggy application
- bunyan module
- about / Bunyan – a battle-tested logger
- URL / Bunyan – a battle-tested logger
- features / Bunyan – a battle-tested logger
C
- caching
- facilitating / Facilitating caching
- caching middleware
- about / Caching middleware – a practical example
- working with / A first try at the caching middleware
- performance benefits, measuring / Measuring the performance benefits of the caching middleware
- configuring / Making the caching middleware configurable
- callback / The functionality of middleware
- callback functions /
- categories, template engines
- logic-less template engines / The different types of template engines
- template engines with logic / The different types of template engines
- programmatic template engines / The different types of template engines
- chai
- URL / should.js
- cheerio
- about / Functional tests
- chokidar module
- URL /
- CI
- about / Continuous Integration
- benefits / Continuous Integration, Free CI for open source projects
- servers / CI servers
- free CI, for open source projects / Free CI for open source projects
- CI software
- URL / CI servers
- clarify module / Richer errors with VError
- client-side testing
- about / Client-side testing
- Client error 4xx status codes
- about / Client error 4xx
- 400 Bad Request / Client error 4xx
- 401 Unauthorized / Client error 4xx
- 403 Forbidden / Client error 4xx
- 404 Not Found / Client error 4xx
- 409 Conflict / Client error 4xx
- 429 Too Many Requests / Client error 4xx
- 422 Unprocessable Entity / Client error 4xx
- closure / Closures to the rescue
- cluster
- using, for handling concurrent connections / Using a cluster to handle more concurrent connections
- cluster-master module
- code
- complexity analysis / Complexity analysis of our code
- code coverage
- about / Code coverage
- code linting
- about / Code linting
- code sharing, between templates
- partials, using / Sharing code between templates with partial views
- complex applications
- I/O bound operations, handling / Complex applications with heavy I/O bound operations
- complexity-report
- compression module
- URL / Compress and minify
- configurable middleware
- creating / Creating configurable middleware
- closure / Closures to the rescue
- caching middleware / Caching middleware – a practical example
- connect-flash module / About routes
- connect-src, CSP directives / HTTP security headers with Helmet
- Connect GitHub page
- consolidate.js
- URL / Logic-less template engines,
- used, for template engine consolidation /
- content delivery network (CDN)
- about / Using a content delivery network
- advantages / Using a content delivery network
- disadvantages / Using a content delivery network
- content negotiation mechanism
- about / Content negotiation
- URL / Content negotiation
- create function / User endpoints
- cross-site request forgery (CSRF) / Ordering of middleware
- CSP directives
- connect-src / HTTP security headers with Helmet
- font-src / HTTP security headers with Helmet
- frame-src / HTTP security headers with Helmet
- img-src / HTTP security headers with Helmet
- media-src / HTTP security headers with Helmet
- object-src / HTTP security headers with Helmet
- script-src / HTTP security headers with Helmet
- CSRF
- CSRF protection
- css(value) function / Sanitizing output
- csurf module
- cuid() module / Creating and testing an Express file-sharing application
- cuid module
- custom-err module /
- custom errors
- creating /
- custom Express error handler
- creating / Creating a custom Express error handler
- custom validation module
- creating / Creating a custom validation module
D
- database library / The database library
- debug flag
- using / Using a debug flag
- debug module, versus regular logger / Debug versus logger
- debugging commands
- removing / Removing debugging commands
- debug module
- features / Using a debug flag
- versus regular logger / Debug versus logger
- debug module, versus regular logger
- benefits / Debug versus logger
- DELETE method / HTTP methods (verbs)
- DRY templates
- using, with layouts / DRY templates with layouts
- Dust.js
- dynamic data
- caching / Caching dynamic data
- dynamic data, caching
- Etag / ETag for dynamic data
E
- EJS, template engines with logic
- EJS module / Error handling in a practical application
- Embedded JavaScript (EJS) / A first try at the caching middleware
- environment-based loading, of middleware / Environment-based loading of middleware
- error
- checking /
- human errors / Runtime (operational) errors and human errors
- runtime errors / Runtime (operational) errors and human errors
- error-handling middleware
- about / A better error-handling middleware
- application, for time display in current time zone / Application for displaying the time in the current time zone
- improved error handler, adding / Adding the improved error handler
- error delivery ways, in Node applications
- synchronous style / Throwing errors in the synchronous style
- error first callback pattern / The error-first callback pattern
- EventEmitter errors / The EventEmitter errors
- error first callback pattern / The error-first callback pattern
- errorhandler
- error handler function
- working on / Adding the improved error handler
- error handling, in practical application
- about / Error handling in a practical application
- application entry point, creating / Creating the application entry point
- Primus, using / Real-time updates with Primus
- Post model / Post and User models
- User model / Post and User models
- routes modules / About routes
- view files / Views and static resources
- static JavaScript file (core.js) / Views and static resources
- application, running / Running the application
- error objects
- features / Strings instead of errors as an antipattern
- errors
- handling, with middleware / Handling errors with middleware
- logging / Logging errors
- errTo module /
- ESLint
- URL / Code linting
- ESLint rules documentation
- URL / Code linting
- esprima
- Etag / ETag for dynamic data
- ETag mechanism
- URL / Facilitating caching
- EventEmitter errors / The EventEmitter errors
- Express
- features / The best parts of Express
- comparing, with frameworks / Comparing Express with other frameworks
- about / Express into the wild
- template engines, integrating with /
- benchmarking, URL /
- used, for serving static resources / Serving static resources with Express
- Express, comparing with frameworks
- about / Comparing Express with other frameworks, Overall
- goal / Goal
- conventions / Conventions
- databases / Databases
- views / Views
- express-validator
- URL / Validating input
- Express application
- REPL, adding to / Adding a REPL to our Express application
- Express applications
- running, on privileged ports / Running Express applications on privileged ports
- root privileges, dropping / Dropping root privileges
- iptables used, for redirecting to another port / Redirecting to another port using iptables
- authbind, using / Using authbind
- Express file-sharing application
- creating / Creating and testing an Express file-sharing application
- testing / Creating and testing an Express file-sharing application
- running / Running the application
- Unit tests / Unit tests
- functional tests / Functional tests
- Express routes
- about / Express routes
- path, specifying / Specifying the path
- reusable route handlers / Reusable route handlers
- route wildcards / Route wildcards
- extend function / Creating a custom validation module
F
- Faker.js
- URL / Generating phony data using Faker.js
- used, for generating phony data / Generating phony data using Faker.js
- falafel
- file model / The file model
- file uploads
- handling / Handling file uploads
- font-src, CSP directives / HTTP security headers with Helmet
- forever tool
- frame-src, CSP directives / HTTP security headers with Helmet
- functionality, middleware
- arguments, request object / The functionality of middleware
- arguments, response object / The functionality of middleware
- arguments, callback / The functionality of middleware
- items. adding to array / Pushing items to an array
- execution flow observation, logs used / Looking at the execution flow using logs
- functional tests
- writing / Functional tests and route implementation
- writing, for users endpoints / User endpoints
- writing, for notes endpoints / Notes endpoints
G
- getFullImagePath method /
- GET method / HTTP methods (verbs)
- gm module
- about / Handling file uploads
- URL / Handling file uploads
- groundskeeper tool
- grunt
- URL / Compress and minify
- guests, SmartNotes application
- actions, performing / SmartNotes application requirements
- gulp
- URL / Compress and minify
H
- Haml.js, template engines with logic
- Handlebars.js
- URL /
- handleRequest method / The main file
- HEAD method / HTTP methods (verbs)
- health endpoint / Simple tips for improving the application monitoring
- heapdump module
- URL / Debugging memory leaks
- Helmet
- HTTP security headers, used with / HTTP security headers with Helmet
- helmet module
- highlight.js module
- hipcache
- URL / Debugging memory leaks
- homebrew /
- html(value) function / Sanitizing output
- HTTP benchmarking tools
- wrk, URL /
- siege, URL /
- httperf, URL /
- httperf tool
- URL /
- HTTP methods
- about / HTTP methods (verbs)
- idempotence property / HTTP methods (verbs)
- GET / HTTP methods (verbs)
- HEAD / HTTP methods (verbs)
- POST / HTTP methods (verbs)
- PUT / HTTP methods (verbs)
- DELETE / HTTP methods (verbs)
- HTTPS
- Stud, using with / HTTPS with Stud
- HTTP security headers
- with Helmet / HTTP security headers with Helmet
- HTTP status codes
- about / HTTP status codes
- code digits / HTTP status codes
- URL / HTTP status codes
- Successful 2xx / Successful 2xx
- Redirection 3xx status codes / Redirection 3xx
- Client error 4xx status codes / Client error 4xx
- Server error 5xx status codes / Server error 5xx
- references / Server error 5xx
- human errors
- hyperglue, programmatic template engines
I
- improved error handler
- adding / Adding the improved error handler
- index function
- roles / About routes
- input
- validating / Validating input
- iptables
- URL / Running Express applications on privileged ports
- used, for redirecting to another port / Redirecting to another port using iptables
- Istanbul
- URL / Code coverage
- items
- pushing, to array / Pushing items to an array
J
- js(value) function / Sanitizing output
- jsAttr(value) function / Sanitizing output
- jsdom
- URL / Client-side testing
- JSHint
- URL / Code linting
- JSLint
- URL / Code linting
- about / Code linting
- jsObj(value) function / Sanitizing output
- json2html, programmatic template engines
- JSON Patch / HTTP methods (verbs)
K
- Karma
- URL / Client-side testing
L
- layouts
- DRY templates, using with / DRY templates with layouts
- load testing
- about / Load testing
- logging
- about / Logging
- advantages / Logging
- bunyan / Bunyan – a battle-tested logger
- important points / Things to note
- logic-less template engines
- login folder, application structure / Group files by features
- logs
- redirecting, to external service / Redirecting logs to an external service
M
- main file, middleware system replication / The main file
- memory leaks
- debugging / Debugging memory leaks
- references / Debugging memory leaks
- metrics
- collecting / Collecting metrics
- parameters, collecting / Collecting metrics
- slowest application endpoint, obtaining / Getting the slowest endpoints of the application
- network traffic, tracking / Tracking the network traffic
- average function response time, measuring / Measuring the average function response time
- middleware
- about / Connecting middleware
- URL / Connecting middleware
- functionality / The functionality of middleware
- environment-based loading / Environment-based loading of middleware
- ordering / Ordering of middleware
- used, for handling errors / Handling errors with middleware
- debugging / Debugging routes and middleware
- middleware parameters
- httpOnly property on the cookie property / Session middleware parameters
- secure property on the cookie property / Session middleware parameters
- maxAge property on the cookie property / Session middleware parameters
- secret property / Session middleware parameters
- middleware system
- replicating / Replicating the middleware system, The main file
- middleware system, replicating
- main file / The main file
- requests, handling / Handling requests
- application, demoing / Demonstrating the application
- routes handler, adding / Adding the routes handler
- mixins
- URL /
- Mocha
- about / Testing toolbox, Mocha
- URL / Mocha
- mocks / Mocks
- Model-View-Controller (MVC)
- about / The best parts of Express, Model-View-Controller
- public folder / Model-View-Controller
- views folder / Model-View-Controller
- routes folder / Model-View-Controller
- application, developing / Developing a real MVC application
- Model-View-Controller (MVC), developing
- folder structure, bootstrapping / Bootstrapping a folder structure
- NPM dependencies, installing / Installing NPM dependencies
- configuration / Setting up the configuration file
- starting script / The starting script
- database library / The database library
- routes folder / Routes
- models / Models
- models, file model / The file model
- models, user model / The User model
- views / Views
- full application, running / Running the full application
- models
- about / Models
- file model / The file model
- user model / The User model
- implementing / Implementing the models
- features for Mongoose models, testing / Test helpers
- Note model / The Note model
- User model / The User model
- modules
- URL /
- used, for enhancing control flow /
- Mongoose models
- User model, creating / Implementing the models, The User model
- Notes model, creating / Implementing the models, The Note model
- mongoose module / Error handling in a practical application
- monitoring tools
- Zag / Useful existing monitoring tools
- backend storages / Useful existing monitoring tools
- monit tool / Ensuring the application uptime
- mon tool
- MovieApp sample application
- creating /
- URL, for documentation /
- application structure /
- required modules /
- server.js file, creating /
- route handlers, creating /
- heavy lifting, performing inside model /
- overview /
- Mustache, logic-less template engines / Logic-less template engines
- mustache.js
N
- network traffic
- tracking / Tracking the network traffic
- next function / Handling requests
- NGiNX
- URL / Using NGiNX
- tasks, performing / Using NGiNX
- node-buffet module
- node-http-proxy
- URL / Debugging memory leaks
- node-inspector
- URL / Using the V8 debugger, Using node-inspector
- using / Using node-inspector
- node-ratelimiter module
- URL / API rate limiting
- node-semver page
- Node applications
- ways, of delivering errors / Ways of delivering errors in the Node applications
- Node modules
- using / Using Node modules
- middleware order / The middleware order can impact performance
- asset versioning / Asset versioning
- content size, minimizing / Compress and minify
- compression module, using / Compress and minify
- in-memory static middleware / An in-memory static middleware
- content delivery network, using / Using a content delivery network
- NGiNX using / Using NGiNX
- Nodes debugger client
- Note model
- about / The Note model
- required attributes / The Note model
- creating / The Note model
- notes endpoints
- functional tests, writing for / Notes endpoints
- npm documentation
- npm registry
- URL /
O
- Object Relational Mapper (ORM) / Databases
- objects
- extending /
- once module
- URL /
- output
- sanitizing / Sanitizing output
P
- partials
- about / Sharing code between templates with partial views
- used, for code sharing between templates / Sharing code between templates with partial views
- passport-local-mongoose module / Error handling in a practical application
- PATCH method / HTTP methods (verbs)
- PhantomJS
- URL / Client-side testing
- POST method / HTTP methods (verbs)
- Post model / Post and User models
- posts-api folder, application structure / Group files by features
- posts route / About routes
- practical application
- error, handling / Error handling in a practical application
- pre-commit module
- Primus
- using / Real-time updates with Primus
- primus module / Error handling in a practical application, Real-time updates with Primus
- privileged ports
- Express applications, running on / Running Express applications on privileged ports
- production
- view caching /
- programmatic template engines
- about / The different types of template engines, Programmatic template engines
- hyperglue / Programmatic template engines
- transparency / Programmatic template engines
- json2html / Programmatic template engines
- proxyquire
- about / Testing toolbox
- PUT method / HTTP methods (verbs)
R
- .register() function / Post and User models
- reap module
- URL / Handling file uploads
- Redirection 3xx status codes
- 301 Moved Permanently / Redirection 3xx
- 302 Found / Redirection 3xx
- 304 Not Modified / Redirection 3xx
- registered users, SmartNotes application
- actions, performing / SmartNotes application requirements
- render function
- tasks /
- Rendr
- REPL
- adding, to Express application / Adding a REPL to our Express application
- repl-client module
- replify module
- req.url property / The functionality of middleware
- request object / The functionality of middleware
- requests, middleware system replication
- handling / Handling requests
- response object / The functionality of middleware
- REST
- overview / An overview of REST
- HTTP methods / HTTP methods (verbs)
- HTTP status codes / HTTP status codes
- RESTful APIs
- precautions, URL / Creating RESTful URLs of the application
- RESTful URLs
- creating / Creating RESTful URLs of the application
- reusable applications / Reusable applications
- reusable route handlers / Reusable route handlers
- rimraf
- about / Functional tests
- root privileges
- dropping / Dropping root privileges
- route handlers
- creating /
- routes
- tasks / About routes
- about / About routes
- posts route, functions / About routes
- create function / About routes
- debugging / Debugging routes and middleware
- routes folder / Routes
- routes handler, middleware system replication
- adding / Adding the routes handler
- route wildcards / Route wildcards
- runtime errors / Runtime (operational) errors and human errors
S
- safe methods / HTTP methods (verbs)
- search method /
- secure-filters module
- URL / Sanitizing output
- html(value) function / Sanitizing output
- js(value) function / Sanitizing output
- jsObj(value) function / Sanitizing output
- jsAttr(value) function / Sanitizing output
- uri(value) function / Sanitizing output
- css(value) function / Sanitizing output
- style(value) function / Sanitizing output
- security middleware, helmet module
- hsts (HTTP Strict Transport Security) / HTTP security headers with Helmet
- about / HTTP security headers with Helmet
- xframe (X-Frame-Options) / HTTP security headers with Helmet
- iexss (X-XSS-Protection for IE8+) / HTTP security headers with Helmet
- ienoopen (X-Download-Options for IE8+) / HTTP security headers with Helmet
- contentTypeOptions (X-Content-Type-Options) / HTTP security headers with Helmet
- hidePoweredBy (remove X-Powered-By) / HTTP security headers with Helmet
- selenium-webdriver
- about / Client-side testing
- URL / Client-side testing
- Selenium Webdriver
- URL / Client-side testing
- serve-static module / Using Node modules
- server-destroy module
- server.js file
- creating /
- Server error 5xx status codes
- problems / Server error 5xx
- 500 Internal Server Error / Server error 5xx
- 501 Not Implemented / Server error 5xx
- 503 Service Unavailable / Server error 5xx
- session middleware
- URL / Session middleware parameters
- parameters / Session middleware parameters
- should.js
- about / Testing toolbox, should.js
- URL / should.js
- siege tool
- URL /
- signup folder, application structure / Group files by features
- single-page applications, Express / Single-page applications
- single callback execution
- ensuring /
- sinon
- about / Testing toolbox
- Sinon.js
- slow-stream module / Throttling
- slowest application endpoint
- obtaining / Getting the slowest endpoints of the application
- SmartNotes application
- requirements / SmartNotes application requirements
- about / SmartNotes application requirements
- types, registered users / SmartNotes application requirements
- types, guests / SmartNotes application requirements
- title attribute / SmartNotes application requirements
- description attribute / SmartNotes application requirements
- userId attribute / SmartNotes application requirements
- rating attribute / SmartNotes application requirements
- category attribute / SmartNotes application requirements
- public attribute / SmartNotes application requirements
- updatedA attribute / SmartNotes application requirements
- implementing / Implementing the SmartNotes application
- SmartNotes application implementation
- bootstrapping phase / The bootstrapping phase
- validation, dealing with / Dealing with validation
- models, creating / Implementing the models
- functional tests, writing / Functional tests and route implementation
- Express routes, implementing / Functional tests and route implementation
- spies / Spies
- stack-trace module
- stack traces
- improving / Improving stack traces
- static JavaScript file (core.js)
- tasks / Views and static resources
- staticMiddleware function / Looking at the execution flow using logs
- static resources
- serving, with Express / Serving static resources with Express
- Node modules, using / Using Node modules
- SteamShovel
- URL / Code coverage
- st nodules
- URL / Using Node modules
- streams
- using, for data processing / Using streams to process data
- StriderCD
- URL / CI servers
- strings
- using, instead of errors / Strings instead of errors as an antipattern
- examples / Strings instead of errors as an antipattern
- stub.callArgWith() function / Unit tests
- stubs / Stubs
- Stud
- URL / HTTPS with Stud
- using, with HTTPS / HTTPS with Stud
- style(value) function / Sanitizing output
- subapplications
- mounting / Mounting subapplications
- use cases / Mounting subapplications
- mountable applications, considerations / Mounting subapplications
- Successful 2xx status codes
- 200 OK / Successful 2xx
- 201 Created / Successful 2xx
- 202 Accepted / Successful 2xx
- 204 No Content / Successful 2xx
- supertest
- about / Testing toolbox, Supertest, Functional tests
- synchronous functions
- avoiding / Avoiding synchronous functions
T
- tail command / Bunyan – a battle-tested logger
- template engines
- about / The different types of template engines
- consolidating, with consolidate.js /
- integrating, with Express /
- selecting /
- selecting, URL /
- template engines with logic
- tests
- running / Running tests before committing in Git
- The Movie Database API
- URL /
- throttling / Throttling
- timezone-js module
- toolbox
- testing / Testing toolbox
- toolbox, testing
- Mocha / Mocha
- should.js / should.js
- Sinon.js / Sinon.js
- supertest / Supertest
- proxyquire / Proxyquire
- phony data generation, Faker.js used / Generating phony data using Faker.js
- transparency, programmatic template engines
- travisify CLI tool
- tree tool /
- trumpet module
- using. for streaming templates / Streaming templates with trumpet
- URL / Streaming templates with trumpet
U
- uncaught exceptions
- handling / Handling uncaught exceptions
- Unit tests / Unit tests
- unsafe methods / HTTP methods (verbs)
- UnxUtils
- uptime monitoring / Useful existing monitoring tools
- uri(value) function / Sanitizing output
- use() function / The main file
- use cases
- about / Use cases
- complex applications, with heavy I/O bound operations / Complex applications with heavy I/O bound operations
- single-page applications / Single-page applications
- reusable applications / Reusable applications
- code sharing, between server and client / Code sharing between the server and the client
- base, for creating complex frameworks / A base to create more complex frameworks
- bad use cases / Bad use cases
- user
- reauthenticating, for sensitive operations / Reauthenticating the user for sensitive operations
- user model / The User model
- User model
- about / The User model
- attributes / The User model
- users folder, application structure / Group files by features
- users endpoints
- functional tests, writing for / User endpoints
V
- V8 debugger
- using / Using the V8 debugger
- buggy application, creating / Creating our buggy application
- Node's debugger client, using / Using Node's debugger client in the terminal
- node-inspector, using / Using node-inspector
- validation
- dealing with / Dealing with validation
- custom validation module, creating / Creating a custom validation module
- performance, improving with memoization / Improving performance with memoization
- Varnish cache
- VError
- about / Richer errors with VError
- verror module
- versionator module
- URL / Asset versioning
- about / Using NGiNX
- view cache setting
- about /
- effects /
- view caching
- view cache setting /
- cache, clearing /
- view files / Views and static resources
- view helpers /
- views folder / Views
W
- watch
- URL /
- wd
- about / Client-side testing
- URL / Client-side testing
- wrk HTTP benchmarking tool
- wrk load testing tool
- URL / Using NGiNX
- wrk tool
- URL /
X
- XSS
- about / Cross-site scripting
- input, validating / Validating input
- output, sanitizing / Sanitizing output
- xtend module
- URL /
- use case /
Z
- Zag
- Zombie.js
- URL / Client-side testing