Book Image

TypeScript Microservices

Book Image

TypeScript Microservices

Overview of this book

In the last few years or so, microservices have achieved the rock star status and right now are one of the most tangible solutions in enterprises to make quick, effective, and scalable applications. The apparent rise of Typescript and long evolution from ES5 to ES6 has seen lots of big companies move to ES6 stack. If you want to learn how to leverage the power of microservices to build robust architecture using reactive programming and Typescript in Node.js, then this book is for you. Typescript Microservices is an end-to-end guide that shows you the implementation of microservices from scratch; right from starting the project to hardening and securing your services. We will begin with a brief introduction to microservices before learning to break your monolith applications into microservices. From here, you will learn reactive programming patterns and how to build APIs for microservices. The next set of topics will take you through the microservice architecture with TypeScript and communication between services. Further, you will learn to test and deploy your TypeScript microservices using the latest tools and implement continuous integration. Finally, you will learn to secure and harden your microservice. By the end of the book, you will be able to build production-ready, scalable, and maintainable microservices using Node.js and Typescript.
Table of Contents (17 chapters)
Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
Index

Testing


Testing is a fundamental aspect of any software development. No matter how good the development team is, there is always scope for improvement or something has been left out of their training. Testing is usually a time-consuming activity that does not get the required attention at all. This has led to the prevalence of behavior-driven development, where developers write unit test cases, then write code, and then run a coverage report to know the status of the test cases.

What and how to test

As microservices are totally distributed, the main question that comes to mind is what to test and how to test. First, let's have a quick look at the major characteristics that define microservices and need to be tested:

  • Independent deployment: Whenever any
    • small or a safe change has been deployed to a microservice, the microservice is ready to be deployed to production. But how do we know whether the change is safe or not? This is where automation test cases and code coverage come into the picture...