Giter Site home page Giter Site logo

tlhunter / distributed-node Goto Github PK

View Code? Open in Web Editor NEW
184.0 184.0 62.0 77 KB

Optional Companion Files for Distributed Systems with Node.js

Home Page: https://thomashunter.name/distributed-systems-with-nodejs

JavaScript 92.32% Dockerfile 5.48% Shell 0.86% Lua 1.33%
nodejs

distributed-node's Introduction

I've contributed to dozens of enterprise Node.js services and have worked for a company dedicated to securing Node.js. I've spoken at several conferences on Node.js and JavaScript, am an O'Reilly published author, and am JSNSD/JSNAD certified.

Links

Books I've Published

distributed-node's People

Contributors

tlhunter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

distributed-node's Issues

Chapter 1: event loop with different result

page number: 13
node: v14.17.3
macOs Big Sur: Version 11.6

const sleep_st = (t) => new Promise((r) => setTimeout(r, t)); 
const sleep_im = () => new Promise((r) => setImmediate(r));
    (async () => {
      setImmediate(() => console.log(1));
      console.log(2);
      await sleep_st(0);
      setImmediate(() => console.log(3));
      console.log(4);
      await sleep_im();
      setImmediate(() => console.log(5));
      console.log(6);
      await 1;
      setImmediate(() => console.log(7));
      console.log(8);
})();

log out:
2 4 1 3 6 8 5 7

setImmediate(() => console.log(1))
console.log(2)
Promise.resolve().then(() =>
	setTimeout(() => {
		setImmediate(() => console.log(3))
		console.log(4)
		Promise.resolve().then(() =>
			setImmediate(() => {
				setImmediate(() => console.log(5))
				console.log(6)
				Promise.resolve().then(() => {
					setImmediate(() => console.log(7))
					console.log(8)
				})
			})
		)
	}, 0)
)

log out:
2 1 4 3 6 8 5 7

CA certificate error

Example: 2-9., How to be your own Certificate Authority
Error in curl call: curl http://localhost:3000
{
"code": "DEPTH_ZERO_SELF_SIGNED_CERT",
"error": "Internal Server Error",
"message": "request to https://localhost:4000/recipes/42 failed, reason: self signed certificate",
"statusCode": 500
}

In Example 2-8 It's ok! In 2-9 no ok!

I added the code below to solve in "consumer-https-basic.js"
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = 0;

Appendix A: Install HAProxy via Homebrew

macOS 12.1

 $ brew install [email protected]
Warning: No available formula with the name "[email protected]". Did you mean haproxy?
==> Searching for similarly named formulae...
This similarly named formula was found:
haproxy
To install it, run:
  brew install haproxy
==> Searching for a previously deleted formula (in the last month)...
Error: No previously deleted formula found.
==> Searching taps on GitHub...
Error: No formulae found in taps.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.