Developing-Microservices-with-Node-js.pdf

2星(超过40%的资源)
所需积分/C币:50 2018-04-04 14:35:56 4.48MB PDF
53
收藏 收藏
举报

This book is a hands-on guide to start writing microservices using Node.js and the most modern frameworks, especially Seneca and PM2. In the chapters, we will discuss how to design, build, test, and deploy microservices using the best practices. We will also discuss a valuable lesson: how to make the right level of compromise in order to avoid over-designing and get the business requirements aligned with the technical solutions. What this book covers Chapter 1, Microservices Architecture, discusses the pros and cons of microservices- oriented architectures. It will be the foundation for the rest of the book. Chapter 2, Microservices in Node.js – Seneca and PM2 Alternatives, introduces Node.js, Seneca, and PM2. In it, we will discuss the structure of a Node.js application and how to run it using PM2. We will also dive into a few alternatives to Seneca and PM2. Chapter 3, From the Monolith to Microservices, covers how to tackle the organic growth (unplanned software changes) using microservices. We will also talk about how to split a monolithic application into microservices. Chapter 4, Writing Your First Microservice in Node.js, explains how to write our first microservice. Chapter 5, Security and Traceability, covers how security and traceability are two important characteristics of modern systems. We need to keep the information secure and the actions traceable. In this chapter, we will discuss how to do it using Seneca. Preface [ viii ] Chapter 6, Testing and Documenting Node.js Microservices, introduces using the main frameworks for testing on Node.js: Mocha and Chai. We will also make use of Sinon (another framework) to mock services. Swagger will be our choice for documenting microservices. Chapter 7, Monitoring Microservices, covers using PM2 to monitor our microservices. We will use it along with Keymetrics to get the maximum benefit of such an advanced tool. Chapter 8, Deploying Microservices, explains how, using PM2, we are going to learn to deploy microse
Developing Microservices with Node js Copyright o 2016 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews rt has been made in the preparation of this book to ensure the accuracy of the information presented However the information contained in this book is sold without warranty, cither express or implied. Neither the author nor Pacl Publishing and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals However, Packt Publishing cannot guarantee the accuracy of this information First published: April 2016 Production reference: 1220416 Published by Packt Publishing ltd Livery place 35 Livery street Birmingham b3 2PB UK ISBN978-1-78588-740-6 www.packtpub.com Credits Author Project Coordinator David gonzalez Judie jose Reviewer Proofreader Kishore kumar Yekkanti Safis Editing Commissioning Editor Indexer Veena pagare Monica Ajmera Mehta Acquisition Editor Production Coordinator Divya poojari Arvindkumar Gupta Content Development Editor Cover work Abhishek jadhay Arvindkumar Gupta Technical editor Pranil Pathare Copy Editor Vibha shukla About the author David gonzalez is a language-agnostic software engineer working in financial services for a number of years, trying to find solutions for the right level of bstraction and learning how to get the right balance between too concrete and too abstract He studied in Spain, but soon moved to the wider and more interesting market of Dublin, where he has been living since 2011. David is currently working as an independent consultant in the FinTech sector. The uRl to his Linkedin account is https://ie.linkedin.com/in/david-gonzalez-737b7383 He loves experimenting with new technologies and paradigms in order to get the broader picture of the complex world of software development To my wife, Ester, thanks for your unconditional support in ever single aspect of my life To my unborn daughter, Elena, may the life give you all the happiness that you are bringing to your parents About the reviewer Kishore Kumar Yekkanti is an experienced professional who has worked across various domains and technologies over the past ten years. He is passionate about eliminating the waste during the software development. Kishore is a huge contributor to and follower of agile principles. Ile is a full-stack developer who wants to build the end-to-end systems, and a polyglot programmer. His current focus is on scaling microservices in highly distributed applications that are deployed using container- based systems(Docker ) on cloud. He has worked as the lead/principal engineer for many well-known companies such as Thoughtworks, Currency Fair, and others, where he lead the teams to attain nirvana through microservices For my partner and best friend Jyothsna, and my daughter, Dhruti, who continues to humour me despite of my crazy schedules Www.Packtpub.com eBooks, discount offers and more Did you know that Packt offers e Book versions of every book published, with PDF andepuBfilesavailableYoucanupgradetotheebookversionatwww.packtpub.Com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touchwithusatcustomercare@packtpub.comformoredetails Atwww.packtpub.comyoucanalsoreadacollectionoffreetechnicalarticlessign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and ebook HIPACKTLiB° https://www2.packtpub.com/books/subscription/packtlib Do you need instant solutions to your it questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books Why subscribe? Fully searchable across every book published by Packt Copy and paste, print, and bookmark content On demand and accessible via a web browser Table of contents Preface Chapter 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 2333458922 Technology alignment How small is too small? Key benefits 13 Resilience 13 Scalability 14 echnology heterogeneity 15 Replaceability Independence 18 Why is replaceability important? 18 Easy to deploy 18 SOA versus microservices Why nodeis? 20 API aggregation 21 The future of Node. js 22 Summary 23 Table of contents Chapter 2: Microservices in Node js- Seneca and PM2 Alternatives 25 Need for Node.js 25 Installing node is npm Seneca, and Pm2 26 earning npm Our first program - hello World 29 Node js threading model 31 Modular organization best practices Javascript Solid design principles 33 Seneca -a microservices framework 36 Inversion of control done right 39 Pattern matching in seneca 40 Patrun-a pattern-matching library 41 Reusing patterns 42 Writing plugins 43 Web server integration PM2-a task runner for Node js 51 Single-threaded applications and exceptions 51 Using PM2-the industry-standard task runner 53 Summary 58 Chapter 3: From the Monolith to Microservices 59 First, there was the monolith 60 How to tackle organic growth? 60 How abstract is too abstract? 63 Then the microservices appeared 64 Disadvantages Splitting the monolith Problems splitting the monolith -it is all about the data 72 Organizational alignment Summary 75 Chapter 4: Writing Your First Microservice in Node. js 77 Micromerce- the big picture 77 Product Manager- the two-faced core 79 Fetching products 81 Fetching by category 82 Fetching by ID 82 Adding a product 83 Removing a product 84 Editing a product 84 Table of Contents Wiring everything up 85 Integrating with Express- how to create a REST API 89 he e-mailer -a common problem 90 How to send e-mails Defining the interface Setting up Mandril 92 Hands on- integrating mandrill in your microservice 94 The fallback strategy 99 The order manager 101 Defining the microservice how to gather non- local data 101 The order manager -the code 105 Calling remote services 105 Resilience over perfection 107 The Ul-API aggregation 108 Need for frontend microservice 109 The code 109 Service degradation -when the failure is not a disaster 117 Circuit breakers Seneca -a simple puzzle that makes our lives easier 120 Seneca and promises 122 Debugging 126 Summary 129 Chapter 5: Security and Traceability Infrastructure logical security 131 SSH-encrypting the communications 132 Application security 135 Common threats- how to be up to date 135 njection 136 Cross-site scripting 139 Cross-site request forgery Open redirects 143 Effective code reviews 144 Traceability 145 Logging 145 Tracing requests 147 Auditing 148 Http codes 149 1xx-informational 150 2xx-success codes 150 3xx- redirection 150 4xx-client errors

...展开详情
试读 127P Developing-Microservices-with-Node-js.pdf
立即下载
限时抽奖 低至0.43元/次
身份认证后 购VIP低至7折
一个资源只可评论一次,评论内容不能少于5个字
hontao2128 前端开发,感觉离服务越来越远了
2019-10-09
回复
您会向同学/朋友/同事推荐我们的CSDN下载吗?
谢谢参与!您的真实评价是我们改进的动力~
上传资源赚钱or赚积分
最新推荐
Developing-Microservices-with-Node-js.pdf 50积分/C币 立即下载
1/127
Developing-Microservices-with-Node-js.pdf第1页
Developing-Microservices-with-Node-js.pdf第2页
Developing-Microservices-with-Node-js.pdf第3页
Developing-Microservices-with-Node-js.pdf第4页
Developing-Microservices-with-Node-js.pdf第5页
Developing-Microservices-with-Node-js.pdf第6页
Developing-Microservices-with-Node-js.pdf第7页
Developing-Microservices-with-Node-js.pdf第8页
Developing-Microservices-with-Node-js.pdf第9页
Developing-Microservices-with-Node-js.pdf第10页
Developing-Microservices-with-Node-js.pdf第11页
Developing-Microservices-with-Node-js.pdf第12页
Developing-Microservices-with-Node-js.pdf第13页
Developing-Microservices-with-Node-js.pdf第14页
Developing-Microservices-with-Node-js.pdf第15页
Developing-Microservices-with-Node-js.pdf第16页
Developing-Microservices-with-Node-js.pdf第17页
Developing-Microservices-with-Node-js.pdf第18页
Developing-Microservices-with-Node-js.pdf第19页
Developing-Microservices-with-Node-js.pdf第20页

试读结束, 可继续阅读

50积分/C币 立即下载