| The software framework is the infrastructure in software development.A mature software framework can speed up software development,improve software quality,and reduce software development costs.The traditional Web application framework developed based on Java,C#and other languages uses a highly coupled front-end development method,and the inefficiency in server-side programming and deployment schemes severely restricts the performance improvement and development efficiency of Web applications.Node.js for the Google V8 engine has an indispensable position in Web application development due to its event-driven and non-blocking I/O features,so a new web application framework is developed to improve the efficiency of software development.It is extremely important.This paper combines the shortcomings of a company's current Web application development framework with the requirements of the new framework,and designs and implements a Web application development framework based on Node.js.Specifically,the work of this article is mainly reflected in the following aspects:(1)The separation of front and rear ends is used to replace the traditional high-coupling development.Traditional web development tends to use the template engine to render pages.This method is beneficial to Search Engine Optimization(SEO).However,with the efficient development of various front-end frameworks,the high coupling caused by back-end rendering has become In the front-end collaborative development,the Web application framework developed in this paper replaces the traditional back-end rendering with the previous back-end,and uses React to develop the front-end management system part of the Web application framework.(2)Secondary development of Koa in the form of extended middleware.Based on Node.js,Koa is the basic Web framework of this application framework.Koa's own functions are relatively basic and limited.This application framework chooses to redevelop Koa in the form of extended middleware to realize the server's server-side functional requirements.In the style design of the application programming interface API,the application framework chooses RESTful as the design specification,and includes a set of role-based rights management module and objects for solving heterogeneous problems of multiple database accesses.The Relational Mapping(ORM)module is also included in the web application framework for exception handling,error code information,and logging modules in development.(3)Change the way the front end and the server are deployed.The deployment of the server and the front-end is slightly different The front-end files and static resources are automatically packaged and uploaded to the Content Delivery Network(CDN)to improve access speed and reduce server access pressure.The server program is deployed in a cluster manner.On the server,multi-process deployment is achieved through pm2 based on the cluster module in Node.js to improve resource utilization and access efficiency.(4)Verify the practicability of the Web application framework through the application in the enterprise network training system. |