Preface

From idling on the runway to flying in the skies, this book will introduce you to the world of corresponding with a database for a Node.js application using Sequelize and MySQL, from generating a schema and fitted for an airline agency to deploying a web application for booking flights in the cloud.

Concepts such as event life cycles, associations, transactions, and pooling connections are covered to get you from start to finish when working on your next application. By the end of this book, you will be proficient and confident in creating, removing, and transforming data between a database management system and a Node.js application using Sequelize.

Who this book is for

This book is for beginner to intermediate JavaScript developers who are new to creating Node.js applications and want to attach a database to their web applications. Having SQL knowledge is a plus, but not a prerequisite, for understanding this book’s contents.

What this book covers

Chapter 1, Introduction to Sequelize and ORM in Node.js, covers installing the necessary prerequisites for the book’s lessons.

Chapter 2, Defining and Using Sequelize Models, covers mapping out your database schema and reading or writing to it.

Chapter 3, Validating Models, covers how to ensure the integrity of your models’ data.

Chapter 4, Associating Models, will help you learn the basics and advantages of creating relationships between models.

Chapter 5, Adding Hooks and Lifecycle Events to Your Models, will go through the order of operations for life cycle events with real-world applicable examples.

Chapter 6, Implementing Transactions with Sequelize, covers encapsulating transactional queries with several different isolation and lock levels.

Chapter 7, Handling Customized, JSON, and Blob Data Types, covers using documented and miscellaneous storage in a relational database.

Chapter 8, Logging and Monitoring Your Application, helps you identify issues and bottlenecks in your application.

Chapter 9, Using and Creating Adapters, covers how to extend, add, and plug into the Sequelize library to create new tools and platforms.

Chapter 10, Deploying a Sequelize Application, covers how to deploy the Avalon Airlines project to a cloud application platform such as Heroku.

To get the most out of this book

All code examples have been tested using Node.js 16, MySQL 5.7, and Sequelize 7 on macOS and Linux. However, the code base should still work with future version releases.

Software/hardware covered in the book

Operating system requirements

Node.js 16

Windows, macOS, or Linux

MySQL 5.7

Windows, macOS, or Linux

Sequelize 7

Windows, macOS, or Linux

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

Download the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Supercharging-Node.js-Application-with-Sequelize. If there’s an update to the code, it will be updated in the GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots and diagrams used in this book. You can download it here: https://packt.link/FqVKp.

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “Mount the downloaded WebStorm-10*.dmg disk image file as another disk in your system.”

A block of code is set as follows:

models.sequelize.sync({
    force: true,
    logging: false
})

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

// INT(4)
var unsignedInteger = DataTypes.NUMBER({
    length: 4,
    zerofill: false,
    unsigned: true,
});

Any command-line input or output is written as follows:

sudo apt-get update
sudo apt install mysql-server

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “We will want to select the Developer Default and Install all products options.”

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, email us at [email protected] and mention the book title in the subject of your message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share Your Thoughts

Once you’ve read Supercharging Node.js Applications with Sequelize, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere?

Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily

Follow these simple steps to get the benefits:

  1. Scan the QR code or visit the link below

https://packt.link/free-ebook/9781801811552

  1. Submit your proof of purchase
  2. That’s it! We’ll send your free PDF and other benefits to your email directly
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset