Book Image

Modern JavaScript Web Development Cookbook

By : Federico Kereki
Book Image

Modern JavaScript Web Development Cookbook

By: Federico Kereki

Overview of this book

JavaScript has evolved into a language that you can use on any platform. Modern JavaScript Web Development Cookbook is a perfect blend of solutions for traditional JavaScript development and modern areas that developers have lately been exploring with JavaScript. This comprehensive guide teaches you how to work with JavaScript on servers, browsers, mobile phones and desktops. You will start by exploring the new features of ES8. You will then move on to learning the use of ES8 on servers (with Node.js), with the objective of producing services and microservices and dealing with authentication and CORS. Once you get accustomed to ES8, you will learn to apply it to browsers using frameworks, such as React and Redux, which interact through Ajax with services. You will then understand the use of a modern framework to develop the UI. In addition to this, development for mobile devices with React Native will walk you through the benefits of creating native apps, both for Android and iOS. Finally, you’ll be able to apply your new-found knowledge of server-side and client-side tools to develop applications with Electron.
Table of Contents (15 chapters)

What this book covers

In this book, we will cover several subjects and the book is divided into five parts. In part
one, in the first two chapters we'll get an overview of JavaScript tools and features:

  • Chapter 1, Working with JavaScript Development Tools, is where we'll study and install several tools that will help our development, such as Visual Studio Code for development, npm for package management, Git for version control, Prettier for source code formatting, ESLint for code quality checks, and Flow for data type checks, among others.
  • Chapter 2, Using Modern JavaScript Features, we will see how to use types in your code, and also go into more recent additions to JavaScript, dealing with strings, scopes, functions, async calls, class-oriented programming, modules, and even a touch of Functional Programming (FP).

In part two, the next three chapters, we'll move on to developing server-side code using Node, ending by writing a complete RESTful server:

  • Chapter 3, Developing with Node, covers the basics of Node, and learn how to use JavaScript for server development. We'll cover themes such as streaming, accessing databases, and executing external processes, among others.
  • Chapter 4, Implementing RESTful Services with Node, we'll see how to develop a server with Express, serving static files, and dealing with Cross-Origin Resource Sharing (CORS) permissions and with authentication rules, tying it all together by building a RESTful set of services.
  • Chapter 5, Testing and Debugging Your Server, will teach you how to debug your code and write unit tests for it by using more tools, including Winston, Morgan, Jest, Postman, and Swagger.

After having worked on the server, we'll move to browsers, which makes up part three of this book. We devote the next five chapters to developing web applications with React and using the server we just developed as our backend, so we'll be going full stack with our development:

  • Chapter 6, Developing with React, we'll learn about the React framework, set it up to use the development tools, and then we'll create a Single Page Application (SPA), which we'll expand in the following chapters.
  • Chapter 7, Enhancing Your Application, deals with styling your application with SASS and StyledComponents, making it adaptive and responsive, and covers accessibility and internationalization concerns.
  • Chapter 8, Expanding Your Application, we'll see how to handle state with Redux, a powerful tool that will be necessary for larger-scale websites, and we'll also include topics such as routing, authorization, and code splitting for performance.
  • Chapter 9, Debugging Your Application, we'll cover themes such as logging and using browser and standalone tools for enhanced debugging.
  • Chapter 10, Testing Your Application, is where we will write unit tests for our code using Jest, and we'll also see how to use Storybook to simplify both development and testing.

It so happens that a variant of React, React Native, can be used to develop mobile
applications, and that will be our next topic for the following two chapters which make up
for part four of this book:

  • Chapter 11, Creating Mobile Apps with React Native, we'll see how to install and use React Native to build a mobile version of our web pages, which will work with different sized devices, in landscape or portrait mode, taking advantage of native features.
  • Chapter 12, Testing and Debugging Your Mobile App, we'll cover how to debug and test our code, using some tools we have already seen, such as Jest and Storybook, plus a few new ones, specific for mobile development.

Finally in part five, for the last chapter of the book we'll use both our server and client-side
knowledge, to develop native desktop applications with Electron:

  • Chapter 13, Creating a Desktop Application with Electron, is where we'll see that we can use Electron together with the tools we have already seen, React and Node, to produce, debug, and test native desktop applications, which you can distribute to users, who will be able to install them on their own machines just as they'd do with any other desktop program.