Koa-setup is a scaffolding tool for quickly creating simple KOA projects
Some scaffolding tools like VUE-CLI are often used to quickly generate the required project structure, files and some basic functions. Koa-setup, described in this article, can help you quickly generate a simple Node-koa project.
ThinkJS JWT authentication practice
Editor's note: I believe authentication should be one of the basic features required for most Web services. There are many ways to implement permission verification, among which JSON Web Token (JWT) is favored by more and more developers. It is a bit more secure than traditional authentication, and relatively speaking, because the encrypted string contains permission letters...
I feel that learning source code needs to be looked at with purpose in order to achieve the effect, but the company has no Node, no practice how to do? Recently found that debugging Koa2 source code is also a good way. You are advised to read node.js Debugging Guide for Node debugging. We just need to learn how to debug in vscode. Without going into details,...
Step by step to read koA source code, middleware implementation principle
Koa middleware performs process control, code is very subtle. This is illustrated by a picture of the onion model. Remember this picture. Why is like this figure, here we have an example to describe the above this example, the order is printed, fn3, fn2 fn1-1-1-1, 2, fn2 fn3 - - 2, fn1-2, only know that now call next (...
In-depth KOA source code (a) : architecture design
I recently read the source code of KOA to clarify the architecture design and the third party library used. This three-part series introduces the architecture of KOA and the principles of the three core libraries, culminating in a manual implementation of a simple KOA. These four files can be divided into three categories based on purpose and encapsulation logic: REQ and RES, context, and application...
Koa2 + Angular7 +mysql write a microblog
The myBlog application was developed using Angular7 + KOA2 +mysql to practice the process of angular writing and introducing plug-ins. The myBlog application was developed using Koa2 to familiarize yourself with some of the main functions of TS and JS conversion syntax
Teach you to understand koA middleware (Onion model) principle
Koa's middleware is different from Express in that Koa uses the Onion model principle. Its source code contains only four files, for the first time to read the source code is very friendly, today we only look at the main file - application.js, it has included middleware is how
Use asynchronous programming to ensure Koa's Onion model
The KOA framework's business process is a fully asynchronous programming model that traverses HTTP upstream and downstream through CTX context objects. The most important thing for us is to understand the Onion model. So let's take a look at a classic onion diagram just to get a sense of where we're going and let's look at this code and let's run this code
Super lightweight level Web framework KOA source code to read
Koa is a very lightweight Web framework with nothing in it but CTX and Middleware, and even the most basic router functions need to be implemented by installing other middleware. It's simple, but it's powerful enough that you can build complete Web services just by relying on middleware mechanisms. Koa's source code is also very concise, with less than 2000 lines of basic code...
Koa asynchrony problem solving thinking
It wasn't until I read the koA source code that the penny dropped. If task0 neither returns next() (returns a new Promise object) nor await next(), it will immediately reach handleResponse(CTX) without ctx.body='hello' being executed. So with Express not...