万本电子书0元读

万本电子书0元读

顶部广告

Developing Microservices with Node.js电子书

售       价:¥

59人正在读 | 0人评论 9.8

作       者:David Gonzalez

出  版  社:Packt Publishing

出版时间:2016-04-01

字       数:279.6万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:此类商品不支持退换货,不支持下载打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Learn to develop efficient and scalable microservices for server-side programming in Node.js using this hands-on guide About This Book Real world example explained chapter after chapter with code examples. Useful concepts for other languages like Java or PHP Easy to follow by people with little to none experience in Node.js Node.js Version 0.12.2 and the latest compatible versions of Seneca and PM2 Who This Book Is For Node.js developer with basic server-side development knowledge - but no knowledge of implementing microservices in Node.js applications. Also useful for developers in other languages like Java or C#. What You Will Learn Identify where the microservice oriented architectures can tackle the most common problems in the software used by the big organisations. Re-architecture an existing monolithic system into a microservices oriented software. Build robust and scalable microservices using Seneca and Node.js. Testing of the microservices in insolation in order to create a solid system. Deploy and manage microservices using PM2 Monitoring the health of a microservice (CPU, memory, I/O…) and how the degradation of the performance in one microservice could degrade the performance of full system. In Detail Microservices architecture is a style of software architecture. As the name suggests, microservicess refers to small services. For a large implementation, this means breaking the system into really small, independent services. Alternative to monolithic architecture (where the entire system is considered as a single big, interwoven segment), microservices approach is getting more and more popular with large, complex applications that have a very long lifecycle, which require changes at regular intervals. Microservices approach allows this type of changes with ease as only a part of the system undergoes changes and change control is easy. An example of such large system can be an online store—includes user interface, managing product catalog, processing orders, managing customer's account. In a microservices architecture each of these tasks will be divided and into smaller services. Also, these services will be further broken down into independent services—for user interface, there will be separate services for input, output, search bar management, and so on. Similarly, all other tasks can be divided in very small and simple services. Style and approach This book is a comprehensive guide to developing production-ready implementation of the microservices architecture with Node.js. Each chapter builds up on the earlier one creating a strong foundation on which you create your own microservice in a distributed environment.
目录展开

Developing Microservices with Node.js

Table of Contents

Developing Microservices with Node.js

Credits

About the Author

About the Reviewer

www.PacktPub.com

eBooks, discount offers, and more

Why subscribe?

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Errata

Piracy

Questions

1. Microservices Architecture

Need for microservices

Monolithic software

Microservices in the real world

Microservice-oriented architectures

How is it better?

Shortcomings

Key design principles

Business units, no components

Smart services, dumb communication pipes

Decentralization

Technology alignment

How small is too small?

Key benefits

Resilience

Scalability

Technology heterogeneity

Replaceability

Independence

Why is replaceability important?

Easy to deploy

SOA versus microservices

Why Node.js?

API aggregation

The future of Node.js

Summary

2. Microservices in Node.js – Seneca and PM2 Alternatives

Need for Node.js

Installing Node.js, npm, Seneca, and PM2

Learning npm

Our first program – Hello World

Node.js threading model

Modular organization best practices

Javascript

SOLID design principles

Seneca – a microservices framework

Inversion of control done right

Pattern matching in Seneca

Patrun – a pattern-matching library

Reusing patterns

Writing plugins

Web server integration

Seneca as Express middleware

Data storage

PM2 – a task runner for Node.js

Single-threaded applications and exceptions

Using PM2 – the industry-standard task runner

Summary

3. From the Monolith to Microservices

First, there was the monolith

How to tackle organic growth?

How abstract is too abstract?

Then the microservices appeared

Disadvantages

Splitting the monolith

Problems splitting the monolith – it is all about the data

Organizational alignment

Summary

4. Writing Your First Microservice in Node.js

Micromerce – the big picture

Product Manager – the two-faced core

Fetching products

Fetching by category

Fetching by ID

Adding a product

Removing a product

Editing a product

Wiring everything up

Integrating with Express – how to create a REST API

The e-mailer – a common problem

How to send e-mails

Defining the interface

Setting up Mandrill

Hands on – integrating Mandrill in your microservice

The fallback strategy

The order manager

Defining the microservice – how to gather non-local data

The order manager – the code

Calling remote services

Resilience over perfection

The UI – API aggregation

Need for frontend microservice

The code

Service degradation – when the failure is not a disaster

Circuit breakers

Seneca – a simple puzzle that makes our lives easier

Seneca and promises

Debugging

Summary

5. Security and Traceability

Infrastructure logical security

SSH – encrypting the communications

Application security

Common threats – how to be up to date

Injection

Input validation

Cross-site scripting

Output encoding

Cross-site request forgery

Open redirects

Effective code reviews

Traceability

Logging

Tracing requests

Auditing

HTTP codes

1xx – informational

2xx – success codes

3xx – redirection

4xx – client errors

5xx – server errors

Why HTTP codes matter in microservices

Summary

6. Testing and Documenting Node.js Microservices

Functional testing

The pyramid of automated testing

Unit tests

Integration tests

End-to-end tests

How much testing is too much?

Testing microservices in Node.js

Chai

BDD-style interfaces

Assertions interface

Mocha

Sinon.JS – a mocking framework

Testing a real microservice

TDD – Test-driven development

Unit testing

End-to-end testing

Manual testing – the necessary evil

Building a proxy to debug our microservices

Postman

Documenting microservices

Documenting APIs with Swagger

Generating a project from the Swagger definition

Summary

7. Monitoring Microservices

Monitoring services

Monitoring using PM2 and Keymetrics

Diagnosing problems

Monitoring application exceptions

Custom metrics

Simple metric

Counter

Average calculated values

Simian Army – the active monitoring from Spotify

Throughput and performance degradation

Summary

8. Deploying Microservices

Concepts in software deployment

Continuous integration

Continuous delivery

Deployments with PM2

PM2 – ecosystems

Deploying microservices with PM2

Configuring the server

Docker – a container for software delivery

Setting up the container

Installing Docker

Choosing the image

Running the container

Installing the required software

Saving the changes

Deploying Node.js applications

Automating Docker container creation

Node.js event loop – easy to learn and hard to master

Clustering Node.js applications

Load balancing our application

Health check on NGINX

Passive health check

Active health check

Summary

Index

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部