Node source code: http module

http module The HTTP module is located in / lib/http.js. Let's take a look at the core method of the module, createServer. function createServer(opts, requestListener) { return new Server(opts, requestListener); } The function of createServer is to create a Server class, which is located in / lib/_http_server.js function Server(options, reque ...

Added by orion2004 on Thu, 24 Oct 2019 11:12:06 +0300

[source code interpretation] thoroughly understand the Events module

Preface Why write this article? Remember clearly that I just got a job at node and talked to the interviewer about the event cycle. Then the interviewer asked how the event happened. Under what circumstances is an event... In which scenarios have Events been applied? Before that, it encapsulated an open source network request framework of RxJa ...

Added by mauri_gato on Thu, 17 Oct 2019 05:08:56 +0300

Docker Tutorial for Front End Engineers - Basic Chapter

Recently, the company has been promoting containerization and k8s, and the project will be changed to Docker deployment. There are several node projects in charge of the project, so you can only learn Docker from scratch. install Docker supports windows, MAC, Linux, tutorial reference Docker Installation Tutorial. Docker is recommended for Mac ...

Added by gordo2dope on Wed, 09 Oct 2019 01:48:33 +0300

node Preliminary - - streams Module

flow In the static file server in the HTTP module chapter, we have seen two examples of writable streams: the server can write data to the response object and to the request object.Writable stream is a concept widely used in node interface. All Writable streams have a write method to pass strings or buffer objects, and an end method to close th ...

Added by Htmlwiz on Mon, 07 Oct 2019 05:25:17 +0300

nodejs: a simple file server

Simple File Server Sometimes, we want to read some files on the server, but we don't want to write too complicated programs. We can consider using nodejs to write a file server easily.Here's a simple file server I wrote with caching. Here's it. github links Or simply copy the following code to run, requiring the installation of mime dependencie ...

Added by reloj_alfred on Tue, 01 Oct 2019 19:04:25 +0300

node Initial - - HTTP module and static file server

HTTP module The HTTP module is one of the most important modules in the node, not one.This module provides the ability to execute HTTP services and generate HTTP requests. In fact, we will use the server written by node, mainly the HTTP module. Let's first look at the code needed by a simple HTTP server. const http = require('http') const serve ...

Added by robin on Sat, 28 Sep 2019 19:25:58 +0300

Hands have a front-end scaffold of their own

Many little buddies have been struggling about what scaffolding is?In fact, the core function is to create the project initial file, the problem comes again, is there not enough scaffolding on the market, why do you want to write it yourself? As soon as you mention scaffolding, you'll think vue-cli, create-react-app, dva-cli.... Their character ...

Added by tidalwave on Mon, 02 Sep 2019 04:08:50 +0300

Queue Chapter of Data Structure Knowing or Not Series

One day, when you look back on the road you have traveled, you will find that these years of constant struggle are the best life. —— Freud Queue, FIFO for short, follows the principle of First In First Out. Contrary to the "stack", it adds elements at the end of the queue and deletes elements at the head of the queue. If t ...

Added by bo0 on Sun, 25 Aug 2019 16:14:43 +0300

jwt is used to implement validation in express framework.

Then the last article (using session to save user data) let jwt to save user data.Passport-jwt/json webtoken is used here.passport-jwt is a validation strategy of passport. It is validated using JWT (json web token).JSON webtoken is a module for encoding, decoding and verifying jwt. Using jwt to save user data and using session to save user dat ...

Added by fourteen00 on Sat, 24 Aug 2019 11:07:48 +0300

koa-router implementation principle

koa router implementation principle Two purposes of this article Understanding the use of path-to-regexp koa-router source parsing path-to-regexp Introduction to path-to-regexp usage. How can it be used to match identified routes? Think about what we can do if we want to identify routes? The most intuitive is definitely a path string match '/ ...

Added by paulspoon on Fri, 23 Aug 2019 19:03:29 +0300