Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Full Stack Development with Angular and GraphQL

You're reading from   Full Stack Development with Angular and GraphQL Learn to build scalable monorepo and a complete Angular app using Apollo, Lerna, and GraphQL

Arrow left icon
Product type Paperback
Published in Mar 2022
Publisher Packt
ISBN-13 9781800202467
Length 390 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Ahmed Bouchefra Ahmed Bouchefra
Author Profile Icon Ahmed Bouchefra
Ahmed Bouchefra
Swathi Prasad Swathi Prasad
Author Profile Icon Swathi Prasad
Swathi Prasad
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Preface 1. Part 1: Setting Up the Development Environment, GraphQL Server, and Database
2. Chapter 1: App Architecture and Development Environment FREE CHAPTER 3. Chapter 2: Setting Up GraphQL with Node.js, Express.js, and Apollo 4. Chapter 3: Connecting the Database with TypeORM 5. Chapter 4: Implementing Authentication and Image Uploads with Apollo Server 6. Chapter 5: Adding Realtime Support with Apollo Server 7. Part 2: Building the Angular Frontend with Realtime Support
8. Chapter 6: Angular Application Architecture and Routing 9. Chapter 7: Adding User Search Functionality 10. Chapter 8: Guarding Routes and Testing Authentication 11. Chapter 9: Uploading Images and Adding Posts 12. Chapter 10: Fetching Posts and Adding Comments and Likes 13. Part 3: Adding Realtime Support
14. Chapter 11: Implementing GraphQL Subscriptions 15. Other Books You May Enjoy

Installing and configuring Node.js

We'll need to install Node.js after installing the MySQL database management system because it's necessary for executing our server code.

We have several options for installing Node.js on our operating system:

  • Node Version Manager (NVM), which you can use to run various versions of Node.js on your development system, acquire information about the available versions, and install any version with a single command
  • The operating system's official package manager, such as APT for Ubuntu, Homebrew for macOS, or Chocolatey for Windows
  • The binaries from the official website at https://nodejs.org/en/download/, which not only provides Windows, macOS, and Linux binaries, but also source code that can be downloaded and compiled

As previously said, we will presume you are running a Debian-based system such as Ubuntu. In this chapter, we'll teach you how to use the first method on an Ubuntu system.

Important Note

If you are not using an Ubuntu or Debian-based system, go to the official website at https://nodejs.org/en/download/package-manager/ and get the necessary instructions to install Node.js on your operating system.

Installing Node.js with nvm

You can install Node.js and npm using nvm instead of your system's native package manager. This utility does not operate at the system level. Instead, it makes use of a distinct folder in your home directory.

This allows you to install several versions of Node.js at the same time and quickly switch between them as needed. In addition, after you've installed nvm, you can quickly install any version of Node.js, old or new, with a single command.

Let's go over the steps:

  1. Return to your command-line interface and run the following command to download the nvm installation script:
    curl -sL https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh 
  2. Then, use the following command to execute the script:
    bash install.sh

This command will clone the nvm repository under the ~/.nvm folder and update the ~/.profile file as necessary.

  1. To begin utilizing nvm, just source the following file or log out and then log back in:
    source ~/.profile
  2. Using this command, you can quickly retrieve a list of available Node.js versions that you can install:
    nvm ls-remote
  3. We are using v12.22.1 in this book, which you can install using the following command:
    nvm install v12.22.1

This will download the installation binary that is compatible with your operating system and install Node.js together with npm. It will also make this version the default version.

  1. To verify the installed version, use the following command:
    node –v

In our case, we get v12.22.1 printed on the Terminal.

More information on the available commands and how to use them may be found in the official repository at https://github.com/nvm-sh/nvm.

The nvm utility is compatible with Linux, macOS, and Windows Subsystem for Linux (WSL). You may use two unofficial alternatives for Windows:

That's everything – you've configured your development machine to run Node.js, allowing you to install and use Node.js packages such as Express.js to build your backend application, as well as frontend libraries and tools such as Angular CLI.

We'll use npm to install the dependencies for our backend and frontend apps throughout this book.

You have been reading a chapter from
Full Stack Development with Angular and GraphQL
Published in: Mar 2022
Publisher: Packt
ISBN-13: 9781800202467
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image