egg.js enterprise web framework

The difference between egg and express, koa

All three are node.js web frameworks, but:

  • Express is suitable for personal projects, and its flexibility is too high;
  • egg is an enterprise-level framework based on koa encapsulation. It implements 约定优于配置application development according to a set of unified agreements, reduces development and learning costs, and unifies code structure so that developers can focus more on business development;
  • Koa is built by the original team of express. Compared with express, it is smaller, more expressive, and more robust. The main differences between koa and express are:
    • The asynchronous programming model is different, express uses promise, koa uses async/await
    • Middleware is handled differently, koa adopts the onion ring model
    • Context: Unlike Express, which only has two objects, Request and Response, Koa adds a Context object as the context object for this request

Common template engines:

  • Java jsp
  • php-smart
  • node nunjucks

jwt

Reference link: JWT (jsonwebtoken)

body-parse

body-parser is a very commonly used express middleware, which is used for post请求parsing 请求体. It is very simple to use. In egg, a middleware like koa-bodyparser is built in.

Reference link: egg official website reading
project link: https://www.yuque.com/lipengzhou/eggjs

Guess you like

Origin blog.csdn.net/yexudengzhidao/article/details/132250330