
Supercharging Node.js Applications with Sequelize
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
Continuous changes in business requirements can make it difficult for programmers to organize business logic into database models, which turns out to be an expensive operation as changes to the database may result in errors and incongruity within applications. Supercharging Node.js Applications with Sequelize helps you get to grips with Sequelize, a reliable ORM that enables you to alleviate these issues in your database and applications. With Sequelize, you'll no longer need to store information in flat files or memory. This book takes a hands-on approach to implementation and associated methodologies for your database that will have you up and running in no time. You'll learn how to configure Sequelize for your Node.js application properly, develop a better sense of understanding of how this ORM works, and find out how to manage your database from Node.js using Sequelize. Finally, you'll be able to use Sequelize as the database driver for building your application from scratch. By the end of this Node.js book, you'll be able to configure, build, store, retrieve, validate, and associate your data from a database to a Node.js application.
All prices
More details
Content
- Cover
- Title Page
- Copyright and credits
- Foreword
- Contributors
- Table of Contents
- Preface
- Part 1 - Installation, Configuration, and the Basics
- Chapter 1: Introduction to Sequelize and ORM in Node.js
- Technical requirements
- Introducing Sequelize
- Advantages of using Sequelize over other alternatives
- Installing the necessary applications, frameworks, and tools to help get you started
- Installing MySQL
- Creating a database
- Installing Node.js
- Configuring Sequelize within an Express application
- Connecting Sequelize with Express
- Summary
- Chapter 2: Defining and Using Sequelize Models
- Technical requirements
- Defining models for a database
- Exploring the various Sequelize data types and when to use them
- STRING
- CHAR
- TEXT/TINYTEXT/MEDIUMTEXT/LONGTEXT
- CITEXT
- NUMBER
- INTEGER/TINYINT/SMALLINT/MEDIUMINT/BIGINT
- FLOAT/REAL
- DECIMAL/DOUBLE
- BOOLEAN
- DATE/DATEONLY/TIME
- NOW
- HSTORE
- JSON
- JSONB
- BLOB
- UUID/UUIDV1/UUIDV4
- VIRTUAL
- ENUM
- ARRAY
- GEOMETRY
- GEOGRAPHY
- CIDR/INET/MACADDR
- TSVECTOR
- Migrating schematic changes and data from Sequelize to the database
- Migrating schematic changes
- Initializing seed data
- Manipulating and querying data using Sequelize
- Reading data
- Complex querying
- Deleting data
- Updating and saving data
- Creating data
- Ordering and grouping
- Limits and pagination
- Advanced Sequelize options for defining models
- sequelize
- modelName
- defaultScope/scopes
- omitNull
- timestamps
- paranoid
- createdAt/updatedAt/deletedAt
- underscored
- freezeTableName
- tableName
- name
- schema
- engine
- charset
- collation
- comment
- initialAutoIncrement
- hooks
- validate
- indexes
- Summary
- Part 2 - Validating, Customizing, and Associating Your Data
- Chapter 3: Validating Models
- Technical requirements
- Using validations as constraints
- allowNull
- unique
- Built-in validations
- Applying validations to our project
- Creating custom validation methods
- Creating custom attribute validators
- Executing validations while performing asynchronous operations
- Handling validation errors
- Summary
- Chapter 4: Associating Models
- Technical requirements
- Association methods
- hasOne
- belongsTo
- hasMany
- belongsToMany
- Renaming associations
- Relationship patterns
- One-to-One
- One-to-Many
- Many-to-Many
- Using custom foreign key definitions
- Querying associations with eager loading and lazy loading
- Lazy loading
- Eager loading
- Using advanced association options
- Using scopes with associations
- Creating Super Many-to-Many relationships
- Using polymorphic associations
- Applying associations to Avalon Airlines
- Summary
- Chapter 5: Adding Hooks and Lifecycle Events to Your Models
- Technical requirements
- Order of operations for lifecycle events
- Defining, removing, and executing lifecycle events
- Defining instance and model lifecycle events
- Removing lifecycle events
- Executing lifecycle events
- Using lifecycle events with associations and transactions
- Putting it all together
- Summary
- References
- Chapter 6: Implementing Transactions with Sequelize
- Technical requirements
- Managed and unmanaged transactions
- Running transactions concurrently
- Running transactions concurrently with Sequelize
- Running transactions with CLS
- Isolation levels and advanced configuration
- Locking rows with Sequelize
- Using life cycle events for transactions
- Putting it all together
- Summary
- Chapter 7: Handling Customized, JSON, and Blob Data Types
- Technical requirements
- Querying JSON and JSONB data
- Using the BLOB column type
- Creating custom data types
- Putting it all together
- Summary
- Part 3 - Advanced Queries, Using Adapters, and Logging Queries
- Chapter 8: Logging and Monitoring Your Application
- Technical requirements
- Configuring logging with all of the available interfaces
- Integrating third-party logging applications such as Pino or Bunyan
- Integrating with Pino
- Integrating with Bunyan
- Collecting metrics and statistics for Sequelize with OpenTelemetry
- Summary
- Chapter 9: Using and Creating Adapters
- Technical requirements
- Installing, configuring, and integrating AdminJS with Sequelize
- Integrating Sequelize with GraphQL
- Creating our own adapter
- Summary
- Chapter 10: Deploying a Sequelize Application
- Technical requirements
- Refactoring and adding flight schedule routes
- Integrating Express' static middleware and securing the admin interface
- Creating a page to list and book flights
- Deploying the application
- Summary
- Index
- Other Books You May Enjoy
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.
File format: ePUB
Copy protection: without DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Use a reader that can handle the file format ePUB, such as Adobe Digital Editions or FBReader – both free (see eBook Help).
- Tablet/Smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePUB works well for novels and non-fiction books – i.e., 'flowing' text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook does not use copy protection or Digital Rights Management
For more information, see our eBook Help page.