Node.js web development server-side development with Node 10 made wasy
Create real-time applications using Node.js 10, Docker, MySQL, MongoDB, and Socket.IO with this practical guide and go beyond the developer's laptop to cover live deployment, including HTTPS and hardened security. About This Book Learn server-side JavaScript coding through the most up-to-date b...
Otros Autores: | |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Birmingham ; Mumbai :
Packt
[2018]
|
Edición: | Fourth edition |
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009631746006719 |
Tabla de Contenidos:
- Cover
- Title Page
- Copyright and Credits
- Dedication
- Packt Upsell
- Contributors
- Table of Contents
- Preface
- Chapter 1: About Node.js
- The capabilities of Node.js
- Server-side JavaScript
- Why should you use Node.js?
- Popularity
- JavaScript at all levels of the stack
- Leveraging Google's investment in V8
- Leaner, asynchronous, event-driven model
- Microservice architecture
- Node.js is stronger for having survived a major schism and hostile fork
- Threaded versus event-driven architecture
- Performance and utilization
- Is Node.js a cancerous scalability disaster?
- Server utilization, the business bottom line, and green web hosting
- Embracing advances in the JavaScript language
- Deploying ES2015/2016/2017/2018 JavaScript code
- Node.js, the microservice architecture, and easily testable systems
- Node.js and the Twelve-Factor app model
- Summary
- Chapter 2: Setting up Node.js
- System requirements
- Installing Node.js using package managers
- Installing on macOS with MacPorts
- Installing on macOS with Homebrew
- Installing on Linux, *BSD, or Windows from package management systems
- Installing Node.js in the Windows Subsystem for Linux (WSL)
- Opening an administrator-privileged PowerShell on Windows
- Installing the Node.js distribution from nodejs.org
- Installing from source on POSIX-like systems
- Installing prerequisites
- Installing developer tools on macOS
- Installing from source for all POSIX-like systems
- Installing from source on Windows
- Installing multiple Node.js instances with nvm
- Installing nvm on Windows
- Native code modules and node-gyp
- Node.js versions policy and what to use
- Editors and debuggers
- Running and testing commands
- Node.js's command-line tools
- Running a simple script with Node.js
- Conversion to async functions and the Promise paradigm.
- Launching a server with Node.js
- NPM - the Node.js package manager
- Node.js, ECMAScript 2015/2016/2017, and beyond
- Using Babel to use experimental JavaScript features
- Summary
- Chapter 3: Node.js Modules
- Defining a module
- CommonJS and ES2015 module formats
- CommonJS/Node.js module format
- ES6 module format
- JSON modules
- Supporting ES6 modules on older Node.js versions
- Demonstrating module-level encapsulation
- Finding and loading CommonJS and JSON modules using require
- File modules
- Modules baked into Node.js binary
- Directories as modules
- Module identifiers and pathnames
- An example of application directory structure
- Finding and loading ES6 modules using import
- Hybrid CommonJS/Node.js/ES6 module scenarios
- Dynamic imports with import()
- The import.meta feature
- npm - the Node.js package management system
- The npm package format
- Finding npm packages
- Other npm commands
- Installing an npm package
- Installing a package by version number
- Global package installs
- Avoiding global module installation
- Maintaining package dependencies with npm
- Automatically updating package.json dependencies
- Fixing bugs by updating package dependencies
- Packages that install commands
- Configuring the PATH variable to handle commands installed by modules
- Configuring the PATH variable on Windows
- Avoiding modifications to the PATH variable
- Updating outdated packages you've installed
- Installing packages from outside the npm repository
- Initializing a new npm package
- Declaring Node.js version compatibility
- Publishing an npm package
- Explicitly specifying package dependency version numbers
- The Yarn package management system
- Summary
- Chapter 4: HTTP Servers and Clients
- Sending and receiving events with EventEmitters
- JavaScript classes and class inheritance.
- The EventEmitter Class
- The EventEmitter theory
- HTTP server applications
- ES2015 multiline and template strings
- HTTP Sniffer - listening to the HTTP conversation
- Web application frameworks
- Getting started with Express
- Setting environment variables in Windows cmd.exe command line
- Walking through the default Express application
- The Express middleware
- Middleware and request paths
- Error handling
- Calculating the Fibonacci sequence with an Express application
- Computationally intensive code and the Node.js event loop
- Algorithmic refactoring
- Making HTTP Client requests
- Calling a REST backend service from an Express application
- Implementing a simple REST server with Express
- Refactoring the Fibonacci application for REST
- Some RESTful modules and frameworks
- Summary
- Chapter 5: Your First Express Application
- Promises, async functions, and Express router functions
- Promises and error handling
- Flattening our asynchronous code
- Promises and generators birthed async functions
- Express and the MVC paradigm
- Creating the Notes application
- Your first Notes model
- Understanding ES-2015 class definitions
- Filling out the in-memory Notes model
- The Notes home page
- Adding a new note - create
- Viewing notes - read
- Editing an existing note - update
- Deleting notes - destroy
- Theming your Express application
- Scaling up - running multiple Notes instances
- Summary
- Chapter 6: Implementing the Mobile-First Paradigm
- Problem - the Notes app isn't mobile friendly
- Mobile-first paradigm
- Using Twitter Bootstrap on the Notes application
- Setting it up
- Adding Bootstrap to application templates
- Alternative layout frameworks
- Flexbox and CSS Grids
- Mobile-first design for the Notes application
- Laying the Bootstrap grid foundation.
- Responsive page structure for the Notes application
- Using icon libraries and improving visual appeal
- Responsive page header navigation bar
- Improving the Notes list on the front page
- Cleaning up the Note viewing experience
- Cleaning up the add/edit note form
- Cleaning up the delete-note window
- Building a customized Bootstrap
- Pre-built custom Bootstrap themes
- Summary
- Chapter 7: Data Storage and Retrieval
- Data storage and asynchronous code
- Logging
- Request logging with Morgan
- Debugging messages
- Capturing stdout and stderr
- Uncaught exceptions
- Unhandled Promise rejections
- Using the ES6 module format
- Rewriting app.js as an ES6 module
- Rewriting bin/www as an ES6 module
- Rewriting models code as ES6 modules
- Rewriting router modules as ES6 modules
- Storing notes in the filesystem
- Dynamic import of ES6 modules
- Running the Notes application with filesystem storage
- Storing notes with the LevelUP data store
- Storing notes in SQL with SQLite3
- SQLite3 database schema
- SQLite3 model code
- Running Notes with SQLite3
- Storing notes the ORM way with Sequelize
- Sequelize model for the Notes application
- Configuring a Sequelize database connection
- Running the Notes application with Sequelize
- Storing notes in MongoDB
- MongoDB model for the Notes application
- Running the Notes application with MongoDB
- Summary
- Chapter 8: Multiuser Authentication the Microservice Way
- Creating a user information microservice
- User information model
- A REST server for user information
- Scripts to test and administer the user authentication server
- Login support for the Notes application
- Accessing the user authentication REST API
- Login and logout routing functions
- Login/logout changes to app.js
- Login/logout changes in routes/index.mjs.
- Login/logout changes required in routes/notes.mjs
- View template changes supporting login/logout
- Running the Notes application with user authentication
- Twitter login support for the Notes application
- Registering an application with Twitter
- Implementing TwitterStrategy
- Securely keeping secrets and passwords
- The Notes application stack
- Summary
- Chapter 9: Dynamic Client/Server Interaction with Socket.IO
- Introducing Socket.IO
- Initializing Socket.IO with Express
- Real-time updates on the Notes homepage
- The Notes model as an EventEmitter class
- Real-time changes in the Notes home page
- Changing the homepage and layout templates
- Running Notes with real-time homepage updates
- Real-time action while viewing notes
- Changing the note view template for real-time action
- Running Notes with real-time updates while viewing a note
- Inter-user chat and commenting for Notes
- Data model for storing messages
- Adding messages to the Notes router
- Changing the note view template for messages
- Using a Modal window to compose messages
- Sending, displaying, and deleting messages
- Running Notes and passing messages
- Other applications of Modal windows
- Summary
- Chapter 10: Deploying Node.js Applications
- Notes application architecture and deployment considerations
- Traditional Linux Node.js service deployment
- Prerequisite - provisioning the databases
- Installing Node.js on Ubuntu
- Setting up Notes and user authentication on the server
- Adjusting Twitter authentication to work on the server
- Setting up PM2 to manage Node.js processes
- Node.js microservice deployment with Docker
- Installing Docker on your laptop
- Starting Docker with Docker for Windows/macOS
- Kicking the tires of Docker
- Creating the AuthNet for the user authentication service
- MySQL container for Docker.
- Initializing AuthNet.