Frank Zammetti
Modern Full-Stack Development
Using TypeScript, React, Node.js, Webpack, and Docker
Frank Zammetti
Pottstown, PA, USA
Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the books product page, located at www.apress.com/9781484257371 . For more detailed information, please visit http://www.apress.com/source-code .
ISBN 978-1-4842-5737-1 e-ISBN 978-1-4842-5738-8
https://doi.org/10.1007/978-1-4842-5738-8
Frank Zammetti 2020
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein.
Distributed to the book trade worldwide by Springer Science+Business Media New York, 1 New York Plaza, New York, NY 10004. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
Dedicated to Traci, Andrew, and Ashley the only people I want to share a shed in the woods with when the zombies come!
(Okay, maybe not the only ones but they get the good canned beans.)
Introduction
You know, when I started learning how to program, it was a piece of cake!
Youd turn on the computer and be greeted by a nice little Ready prompt. Youd start typing in some code (BASIC), and eventually, youd type run, hit Enter, and watch whatever it was you put in there spit back something (my first program was a man drawn with various keyboard characters doing jumping jacks). You might save that program to a cassette yes, kids, acassette! and hand it to your friends if you wanted to share.
But that was it. It was just that easy.
Nowadays, though, the story isverydifferent.
Writing even a trivial application now involves layers upon layers of abstractions and complexities that you must mix together, like baking the worlds most complicated cake, hoping it all works in the end. Then, should you want to distribute the technological terror youve constructed (sorry, Aldearan), youve got even more challenges to overcome.
Howanyonelearns to program from scratch these days, Im not sure!
But Im hoping to help there!
With this book, Im going to look at the ingredients that go into baking a cake err, building an application these days. To be sure, it wont cover everything. And no one recipe is necessarily the same anyway there are lots of choices available to a developer now. But I believe Ive chosen the ones most commonly used to build modern full-stack applications.
What exactly is a full-stack application anyway? Well, simply put, its an application that includes both a front-end client, like a web site, and a back-end server, like, well, aserver! Were talking about building an application that combines those two halves into a coherent whole. Most application development these days is web-based in some way (where web doesnt have to mean something available on the public Internet, but something built with web technologies like HTML, JavaScript, and CSS), so thats what were going to be doing in this book.
To do this, were going to use React, which is one of the most popular libraries for building clients out there today. And well use Node.js, which is a popular choice for back-end development. Were also going to use TypeScript, a language that enhances JavaScript on both sides of the fence to make our coding lives better. Were going to touch on several other tools that relate to all of this including Babel and Webpack. Well talk about some strategies for connecting the client to the server including REST and WebSockets. Finally, youll learn about packaging up applications using the very popular Docker.
All this will be combined to build two full, real applications. This way, its not just simple, contrived examples. No, itll be real code, practical solutions to real problems encountered in building them, and real techniques for putting all these pieces together and making sense of all this complexity.
In the end, youll have a solid foundation for building modern full-stack applications that you can go forward with on your own to create greatness.
I mean itll never be as great as my guy doing jumping jacks written in BASIC and loaded off a cassette, but you gotta have goals.
So lets get to it. Theres work to be done, learning to be accomplished, and, I hope, fun to be had!
Acknowledgments
Id like to acknowledge the exceptional team at Apress for allowing me to write not one but twelve books for them over the last decade or so. Ive worked with so many great people, and its virtually impossible not to forget someone in a list like this, but among the crew for sure are Ami Knox, Arockia Rajan Dhurai, Beth Christmas, Dulcy Nirmala Chellappa, Chris Mills, Christine Ricketts, Dominic Shakeshaft, Douglas Pundick, Frank Parnell, Frank Pohlmann, Gary Cornell, Jill Balzano, Julie Miller, Katie Stence, Kelly Gunther, Kelly Winquist, Kevin Shea, Kim Wimpsett, Kimberly van der Elst, Krishnan Sathyamurthy, Laura Cheu, Laura Esterman, Leah Weissburg, Leonard Cuellar, Liz Welch, Louise Corrigan, Marilyn Smith, Michelle Lowman, Nancy Chen, Nicole Faraclas, Nirmal Selvaraj, Richard Dal Porto, Sharon Wilkey, Sofia Marchant, Stephanie Parker, Steve Anglin, Tina Nielsen, and Tracy Brown Collins.
As I said, Im sure Ive forgotten someone, but rest assured it was not on purpose! Thank you all for giving me a shot and allowing me to continue this journey. I most definitely could not have done it alone and I thank you all, unreservedly!