Book description
Become a senior developer by building enterprise applications that use modern techniques such as TDD, containerization, continuous integration, and deployment
Key Features
- Create production-grade JavaScript applications from scratch
- Build microservices and deploy them to a Docker container for scaling applications
- Test and deploy your code with confidence using Travis CI
Book Description
With the over-abundance of tools in the JavaScript ecosystem, it's easy to feel lost. Build tools, package managers, loaders, bundlers, linters, compilers, transpilers, typecheckers - how do you make sense of it all?
In this book, we will build a simple API and React application from scratch. We begin by setting up our development environment using Git, yarn, Babel, and ESLint. Then, we will use Express, Elasticsearch and JSON Web Tokens (JWTs) to build a stateless API service. For the front-end, we will use React, Redux, and Webpack.
A central theme in the book is maintaining code quality. As such, we will enforce a Test-Driven Development (TDD) process using Selenium, Cucumber, Mocha, Sinon, and Istanbul. As we progress through the book, the focus will shift towards automation and infrastructure. You will learn to work with Continuous Integration (CI) servers like Jenkins, deploying services inside Docker containers, and run them on Kubernetes.
By following this book, you would gain the skills needed to build robust, production-ready applications.
What you will learn
- Practice Test-Driven Development (TDD) throughout the entire book
- Use Cucumber, Mocha and Selenium to write E2E, integration, unit and UI tests
- Build stateless APIs using Express and Elasticsearch
- Document your API using OpenAPI and Swagger
- Build and bundle front-end applications using React, Redux and Webpack
- Containerize services using Docker
- Deploying scalable microservices using Kubernetes
Who this book is for
If you're a JavaScript developer looking to expand your skillset and become a senior JavaScript developer by building production-ready web applications, then this book is for you.
Table of contents
- Title Page
- Copyright and Credits
- Dedication
- Packt Upsell
- Contributors
- Preface
- The Importance of Good Code
- The State of JavaScript
-
Managing Version History with Git
- Setting up Git
- Learning the basics
- Branching and merging
- Releasing code
- Hotfixes
- Working with others
- Summary
-
Setting Up Development Tools
- What is Node.js?
- Modules
- Installing Node
- Starting projects with npm
- Using yarn instead of npm
- Creating an HTTP server
- Transpiling ES6 with Babel
- Consolidating commands with npm scripts
- Automating development using nodemon
- Linting with ESLint
- Committing our code into Git
- Summary
-
Writing End-to-End Tests
- Understanding different types of test
- Following a TDD workflow
- Gathering requirements
- Setting Up E2E tests with Cucumber
- Implementing step definitions
- Validating data type
- Migrating our API to Express
- Moving common logic into middleware
- Validating our payload
- Testing the success scenario
- Summary
-
Storing Data in Elasticsearch
- Introduction to Elasticsearch
- Installing Java and Elasticsearch
- Understanding key concepts in Elasticsearch
- Querying Elasticsearch from E2E tests
- Indexing documents to Elasticsearch
- Cleaning up after our tests
- Summary
-
Modularizing Our Code
- Modularizing our code
-
Adding a user profile
- Writing a specification as a test
- Schema-based validation
- Types of schema
- Picking an object schema and validation library
- Creating our profile schema
- Creating a schema for the Create User request payload
- Picking a JSON Schema validation library
- Validating against JSON Schema with Ajv
- Generating validation error messages
- Generalizing functions
- Updating the npm build script
- Testing the success scenario
- Resetting our test index
- Summary
-
Writing Unit/Integration Tests
- Picking a testing framework
- Structuring our test files
- Writing our first unit test
- Completing our first unit test suite
- Unit testing ValidationError
- Unit testing middleware
- Unit testing the request handler
- Unit testing our engine
- Integration testing our engine
- Adding test coverage
- Finishing up
- Summary
- Designing Our API
- Deploying Our Application on a VPS
- Continuous Integration
-
Security – Authentication and Authorization
- What is Authentication?
- Introduction to password-based authentication
- Implementing password-base authentication
- Keeping users authenticated
- Next steps
- Summary
-
Documenting Our API
- Overview of OpenAPI and Swagger
- Defining an API specification with OpenAPI
- Generating documentation with Swagger UI
- Deployment
- Summary
-
Creating UI with React
- Picking a front-end framework/library
- Getting started with React
- Modularizing React
- Summary
-
E2E Testing in React
- Testing strategies
- Writing E2E tests with Gherkin, Cucumber, and Selenium
- Routing with React Router
- TDD
- Over to you
- Summary
- Managing States with Redux
- Migrating to Docker
-
Robust Infrastructure with Kubernetes
- High availability
- High reliability
- High throughput
- High scalability
- Clusters and microservices
- Cluster management
- Picking a cluster management tool
- Control Planes and components
- Kubernetes objects
- Setting up the local development environment
- Creating our cluster
- Creating our first Pod
- Understanding high-level Kubernetes objects
- Declarative over imperative
- Configuring Elasticsearch cluster
- Deploying on cloud provider
- Persisting data
- Introducing PersistentVolume (PV)
- Dynamic volume provisioning with StorageClass
- Visualizing Kubernetes Objects using the Web UI Dashboard
- Deploying the backend API
- Creating a backend Service
- Exposing services through Ingress
- Summary
- Other Books You May Enjoy
Product information
- Title: Building Enterprise JavaScript Applications
- Author(s):
- Release date: September 2018
- Publisher(s): Packt Publishing
- ISBN: 9781788477321
You might also like
book
Hands-On JavaScript High Performance
An example-driven guide covering modern web app development techniques and emerging technologies such as WebAssembly, Service …
book
Simplifying JavaScript
The best modern JavaScript is simple, readable, and predictable. Learn to write modern JavaScript not by …
book
Modern JavaScript Web Development Cookbook
Over 90 recipes to help you write clean code, solve common JavaScript problems, and work on …
book
JavaScript by Example
A project based guide to help you get started with web development by building real-world and …