Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
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
Hands-On Full-Stack Web Development with GraphQL and React

You're reading from   Hands-On Full-Stack Web Development with GraphQL and React Build scalable full-stack applications while learning to solve complex problems with GraphQL

Arrow left icon
Product type Paperback
Published in Jan 2019
Publisher Packt
ISBN-13 9781789134520
Length 460 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Sebastian Grebe Sebastian Grebe
Author Profile Icon Sebastian Grebe
Sebastian Grebe
Arrow right icon
View More author details
Toc

Table of Contents (15) Chapters Close

Preface 1. Preparing Your Development Environment FREE CHAPTER 2. Setting up GraphQL with Express.js 3. Connecting to The Database 4. Integrating React into the Back end with Apollo 5. Reusable React Components 6. Authentication with Apollo and React 7. Handling Image Uploads 8. Routing in React 9. Implementing Server-Side Rendering 10. Real-Time Subscriptions 11. Writing Tests 12. Optimizing GraphQL with Apollo Engine 13. Continuous Deployment with CircleCI and Heroku 14. Other Books You May Enjoy

Installing and configuring Node.js

The first step for preparing for our project is to install Node.js. There are two ways to do this:

  • One option is to install the Node Version Manager (NVM). The benefit of using NVM is that you are easily able to run multiple versions of Node.js side by side and this handles the installation process for you on nearly all UNIX-based systems, such as Linux and macOS. Within this book, we do not need the option to switch between different versions of Node.js.
  • The other option is to install Node.js via the package manager of your distribution if you are using Linux. The official PKG file is for Mac, whilst the MSI file is for Windows. We are going to use the regular Linux package manager for this book as it is the easiest method.
You can find the Downloads section of Node.js at the following link, https://nodejs.org/en/download/.

We are taking the second option above. It covers the regular server configurations and is easy to understand. I will keep this as short as possible and skip all other options, such as Chocolatey for Windows or Brew for Mac, which are very specialized for those specific operating systems.

I assume that you are using a Debian-based system for ease of use with this book. It has got the normal APT package manager and repositories to easily install Node.js and MySQL. If you are not using a Debian-based system, you can look up the matching commands to install Node.js at https://nodejs.org/en/download/package-manager/.

Our project is going to be new so that we can use Node.js 10 without any problems. You can skip the following installation of Node.js if you are running version 6 or higher:

  1. First, let's add the correct repository for our package manager by running:
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash –
  1. Next, install Node.js and the build tools for native modules, using the following command:
sudo apt-get install -y nodejs build-essential
  1. Finally, let's open a terminal now and verify that the installation was successful:
node --version
The installation of Node.js via the package manager will automatically install npm.

Great. You're now set up to run server-side JavaScript with Node.js and install Node.js modules for your projects with npm.

All of the dependencies that our project relies on are available at https://npmjs.com and can be installed with npm or Yarn, if you are comfortable with these.

You have been reading a chapter from
Hands-On Full-Stack Web Development with GraphQL and React
Published in: Jan 2019
Publisher: Packt
ISBN-13: 9781789134520
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