Static resource management method, Node.js application, electronic device and storage medium

By introducing static resource management methods in Node.js applications, using middleware, interceptor, controller and view template engines, the problems of low efficiency of multilingual static page development and poor flexibility of static resource management are solved, and efficient static resource management and multilingual support are achieved.

CN114489622BActive Publication Date: 2025-04-25CTRIP TRAVEL NETWORK TECH SHANGHAI0
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210136966.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-15
Publication Date
2025-04-25
Estimated Expiration
2042-02-15

AI Technical Summary

Technical Problem

The existing static resource management platform is inefficient in the multilingual static page development process, and cannot achieve flexible management of static resources, making it difficult to maintain later.

Method used

The static resource management method based on Node.js is adopted to realize personalized management and flexible maintenance of static resources through middleware, interceptor, controller and view template engine. This method includes rendering the static page on the client side and supporting multilingual static resource management through the Shark multilingual platform.

Benefits of technology

It improves the development efficiency of static pages, realizes personalized management and flexible maintenance of static resources, simplifies the development process of multi-language static pages, reduces duplicate and redundant work, and improves the convenience of post-maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114489622B_ABST
    Figure CN114489622B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of computer technology, and provides a static resource management method, a Node.js application, an electronic device and a storage medium. The Node.js application includes a middleware, an interceptor, a controller and a view template engine, and the static resource management method includes: the middleware responds to and transmits a static resource request; the interceptor searches for matching static resource data in the cache, and if so, obtains the static resource data and loads it to the view template engine, otherwise transmits the static resource request; when the controller receives the static resource request, it obtains the service object by dependency injection, obtains the static resource data according to the service object, and calls a routing processing function to load the static resource data into the view template engine; the view template engine renders and generates a static page according to the received static resource data. The present invention can realize personalized management and flexible maintenance of static resources, improve the development efficiency of static pages, and is particularly suitable for the management of static resources in multiple languages.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a static resource management method, a Node.js application, an electronic device and a storage medium. Background Art

[0002] With the rapid development of front-end technology, the number of static resources in application projects is increasing, and the cost of managing and maintaining these static resources is increasing. Therefore, the static resource management platform came into being.

[0003] The current common static resource management platforms, such as FoxPage and Ares, are powerful and cover a wide range of businesses, but the development process of static pages is still relatively long, especially for multi-language static pages, which require the development of corresponding content for each language. The workload is large, and there are many repeated and redundant parts, which results in poor efficiency. In addition, it is impossible to achieve flexible management of static resources, and subsequent maintenance is more difficult.

[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0005] In view of this, the present invention provides a static resource management method, a Node.js application, an electronic device and a storage medium, which can realize personalized management and flexible maintenance of static resources, improve the development efficiency of static pages, and are particularly suitable for the management of static resources in multiple languages.

[0006] According to one aspect of the present invention, there is provided a static resource management method, based on a Node.js application, the Node.js application comprising a middleware, an interceptor, a controller and a view template engine, the static resource management method comprising: the middleware responds to a static resource request initiated by a client and transmits the static resource request; the interceptor searches the cache for static resource data matching the static resource request according to the static resource request, and if so, obtains the matching static resource data and loads it to the view template engine, otherwise, transmits the static resource request; when the controller receives the static resource request, it obtains a service object by means of dependency injection, obtains static resource data according to the service object, and calls a routing processing function to load the obtained static resource data into the view template engine; the view template engine renders and generates a static page on the client according to the received static resource data.

[0007] In some embodiments, the Node.js application also includes unit function modules, each of which stores corresponding static resource data in the form of key-value pairs; the controller obtains the corresponding static resource data from the corresponding unit function module according to the service object.

[0008] In some embodiments, the Node.js application also includes a Shark platform and a static page template; the static resource management method also includes: the Shark platform receives page development data based on the static page module configuration, the page development data carries static resource data identified by a key, publishes a static page according to the page development data, and generates a unit function module according to the static resource data in the page development data; and / or, the Shark platform receives page modification data based on the static page module configuration, the page modification data carries static resource data identified by a key, modifies the corresponding static page according to the page modification data, and modifies the corresponding unit function module according to the static resource data in the page modification data.

[0009] In some embodiments, the Shark platform supports multiple languages, and the static resource data is multi-language static resource data; the view template engine renders and generates multi-language static pages based on the multi-language static resource data.

[0010] In some embodiments, the middleware also records the first parameter information of the static resource request through Edge Logger, and the interceptor also records the second parameter information of the static resource request through ES Logger; the first parameter information includes: request method, uniform resource locator, response time, request status and warning information; the second parameter information includes: cache information, locale, currency, response status and average response time.

[0011] In some embodiments, the Node.js application further includes a decorator, and the static resource management method further includes: the decorator performing decentralized routing processing on the routing processing function.

[0012] In some embodiments, the Node.js application further includes a filter, and the static resource management method further includes: the filter captures exception information of the middleware, the interceptor, and the controller, and records the exception information through EdgeLogger.

[0013] According to one aspect of the present invention, there is provided a Node.js application, based on the static resource management method described in any of the above embodiments, the Node.js application comprising: a middleware, for transmitting the static resource request in response to a static resource request initiated by a client; an interceptor, for searching in a cache whether there is static resource data matching the static resource request, if so, obtaining the matching static resource data and loading it into a view template engine, otherwise transmitting the static resource request; a controller, for obtaining a service object by means of dependency injection when receiving the static resource request, obtaining static resource data according to the service object, and calling a routing processing function to load the obtained static resource data into the view template engine; the view template engine, for rendering and generating a static page on the client according to the received static resource data.

[0014] According to one aspect of the present invention, there is provided an electronic device, comprising: a processor; and a memory, wherein the memory stores executable instructions; wherein when the executable instructions are executed by the processor, the static resource management method as described in any of the above embodiments is implemented.

[0015] According to one aspect of the present invention, a computer-readable storage medium is provided for storing a program, wherein when the program is executed by a processor, the static resource management method as described in any of the above embodiments is implemented.

[0016] The beneficial effects of the present invention compared with the prior art include at least:

[0017] The present invention can realize efficient rendering of static pages and personalized management and flexible maintenance of static resources, and improve the development efficiency of static pages; by utilizing the unified view template engine of the Node.js application, multilingual content can be directly loaded into the view template engine on the server side, and static pages in different languages ​​can be rendered, thereby realizing efficient rendering of static pages in multiple languages; and through the Shark multilingual platform, when it is necessary to develop / modify a page, it can be operated directly on the Shark platform without performing any operation on the page, thereby simplifying the development process of static pages, reducing repeated and redundant work, improving overall development efficiency, and improving the convenience of later maintenance.

[0018] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present invention, and together with the specification are used to explain the principles of the present invention. Obviously, the accompanying drawings described below are only some embodiments of the present invention, and for those of ordinary skill in the art, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0020] Figure 1 A schematic diagram showing the steps of a static resource management method in one embodiment of the present invention;

[0021] Figure 2 A schematic diagram showing the architecture of a Node.js application in an embodiment of the present invention is shown;

[0022] Figure 3 A schematic diagram showing a scenario of a static resource management method in an embodiment of the present invention;

[0023] Figure 4 A schematic diagram showing the process of developing a static page in one embodiment of the present invention is shown;

[0024] Figure 5 A schematic diagram showing the entire process of static page development in one embodiment of the present invention is shown;

[0025] Figure 6 A schematic diagram of a module of a Node.js application in an embodiment of the present invention is shown;

[0026] Figure 7 A schematic structural diagram of an electronic device in an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0027] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the embodiments set forth herein. Instead, these embodiments are provided to make the present invention comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art.

[0028] The accompanying drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0029] In addition, the processes shown in the accompanying drawings are only exemplary and do not necessarily include all the steps. For example, some steps can be decomposed, some steps can be combined or partially combined, and the actual execution order may change according to the actual situation. The words "first", "second" and similar words used in the specific description do not indicate any order, quantity or importance, but are only used to distinguish different components. It should be noted that the embodiments of the present invention and the features in different embodiments can be combined with each other without conflict.

[0030] The static resource management method of the present invention is based on Node.js application, and the Node.js application mainly includes middleware, interceptor, controller and view template engine. Figure 1 The main steps of a static resource management method in an embodiment are shown, referring to Figure 1 As shown, the static resource management method of this embodiment includes:

[0031] Step S110, the middleware responds to the static resource request initiated by the client and transmits the static resource request; Step S120, the interceptor searches the cache for static resource data that matches the static resource request based on the static resource request, and if so, obtains the matching static resource data and loads it to the view template engine, otherwise, transmits the static resource request; Step S130, when the controller receives the static resource request, it obtains the service object through dependency injection, obtains the static resource data based on the service object, and calls the routing processing function to load the obtained static resource data into the view template engine; Step S140, the view template engine renders and generates a static page on the client based on the received static resource data.

[0032] The above-mentioned static resource management method based on Node.js application can quickly obtain cached static resource data through the interceptor to improve the response speed and reduce system overhead, and can efficiently render and generate static pages according to the received static resource data through the view template engine. The static resource data can be multi-language static resource data, and the view template engine can render and generate multi-language static pages according to the multi-language static resource data, thereby realizing convenient management of multi-language static resource data.

[0033] Figure 2 The architecture of the Node.js application in one embodiment is shown, referring to Figure 2As shown, in a specific example, Node.js application 200 is built using the progressive Nest.js framework, and Web Pack (a module packager) is used to package application resources. The architecture of Node.js application 200 mainly includes four parts, namely unit function module (Module) 210, view template engine (View) 220, static server (Public) 230 and tool (Tools) 240. Among them, the unit function module 210 is used to store the corresponding static resource data, and the static resource data in each project can be personalized for management. A project is divided into a unit function module 210, and each unit function module 210 does not affect each other. In each unit function module 210, the corresponding static resource data is stored in the form of key-value pairs. The view template engine 220 includes some static page templates (hbs). The static server 230 mainly stores some pictures, pdf, style files (css, js, images), etc. Tool 240 includes Shark platform, interceptor, decorator, middleware, filter, etc.

[0034] Figure 3 A scenario of a static resource management method in an embodiment is shown, combined with Figure 2 and Figure 3 As shown, for the life cycle of a static resource request (HTTP request), the Node.js application 200 performs the following processing:

[0035] S310, the middleware responds to the HTTP request of the client 300 and records the first parameter information of the HTTP request in Cat and Clog through Edge Logger (a log recorder). The first parameter information may specifically include: request method (Req Method), uniform resource locator (URL), response time (Res Time), request status (Status) and warning information (WARNING), etc. The middleware also transmits the HTTP request to the interceptor.

[0036] S320, the interceptor accesses the Caching cache. The Caching cache stores the corresponding static resource data in the memory in the form of key-value pairs. The interceptor determines whether the requested static resource data hits the cache. If so, the corresponding static resource data is directly returned, which greatly improves the response speed.

[0037] Specifically, the interceptor can traverse the cache with the identification information carried in the HTTP request to determine whether the identification information hits the cache. If so, it can obtain the matching static resource data from the cache and load it into the view template engine. Otherwise, it transmits the HTTP request to the controller.

[0038] In addition, the interceptor also performs logging based on ES Logger (a logger), and the second parameter information of the recorded HTTP request may mainly include: cache information (Cookie), Locale, currency, average response time, etc.

[0039] S330, when the controller receives the HTTP request, it obtains the service object from the service through dependency injection (DI) and performs corresponding logic processing to obtain static resource data. The controller can specifically obtain the corresponding static resource data from the corresponding unit function module according to the service object. The controller also executes the corresponding routing processing function and loads the obtained static resource data into the view template engine. Some decorators are also used on the Controller function. For example, the decorator can perform routing decentralized processing on the routing processing function.

[0040] The controller may also store the obtained static resource data in a cache so that the same static resource data can be directly obtained from the cache the next time the static resource data is requested.

[0041] In addition, before the static resource data is loaded into the view template engine, it can also pass through an interceptor to record parameter information such as the response status (Res Status) through ESLogger.

[0042] During the request / data transmission process, a global filter is also used to capture global exceptions, and then record ERROR type information through Edge Logger. Specifically, the filter can capture exception information of middleware, interceptors, and controllers, and record exception information through Edge Logger.

[0043] S340, the view template engine (View) renders a static page based on the static resource data and returns it to the client 300 in the form of an HTTP response.

[0044] In one embodiment, through the Node.js application, efficient development and flexible maintenance of static pages can also be achieved. Specifically, the static resource management method also includes: the Shark platform receives page development data based on the static page module configuration, the page development data carries static resource data identified by a key, publishes the static page according to the page development data, and generates a unit function module according to the static resource data in the page development data; and / or, the Shark platform receives page modification data based on the static page module configuration, the page modification data carries static resource data identified by a key, modifies the corresponding static page according to the page modification data, and modifies the corresponding unit function module according to the static resource data in the page modification data.

[0045] Figure 4 The process of developing a static page in one embodiment is shown, combined with Figure 2 and Figure 4 As shown, through Node.js application 200, the general process of static page development includes: the front end uses the View template (static page module) to develop the page according to the static page development requirements, establishes a key for the corresponding static page data and submits it to the Shark platform for acceptance and release.

[0046] Figure 5 The whole process of static page development in one embodiment is shown, and then combined with Figure 5 As shown in the figure, in the actual process, when there is a need for static page development, the product team submits the static page development requirements to the content team for translation, and then delivers the translated static page documents to the front-end for development. Front-end developers can use View templates to design static pages, and at the same time establish corresponding keys for various static resource data and submit them to the Shark platform. After the page development is completed, the static page can be published. In addition, the Shark platform can generate the unit function module of the corresponding project based on the static resource data in the page development data, and store the corresponding static resource data in the form of key-value pairs.

[0047] The Shark platform can support multiple languages, thereby publishing static pages in multiple languages.

[0048] When a static page needs to be modified, it can be modified and published directly on the Shark platform. The front-end development does not need to perform any operations during the entire process, and the overall development efficiency is greatly improved.

[0049] In summary, the static resource management method of the present invention can solve the problem of low efficiency in developing multi-language static pages and difficult personalized management and maintenance. Through the Node.js application, a unified view template engine is used in the Node.js application, and multi-language content is directly loaded into the view template engine on the server side to render static pages in different languages, thereby achieving efficient rendering of multi-language static pages, greatly reducing repetitive and redundant work, and improving overall development efficiency. In addition, the Node.js application uses the Shark multi-language platform. When it is necessary to develop / modify a page, it can be operated directly on the Shark platform without any operation on the page, which greatly simplifies the development process of static pages and improves the convenience of later maintenance.

[0050] The embodiment of the present invention further provides a Node.js application, which can be used to implement the static resource management method described in any of the above embodiments. The features and principles of the static resource management method described in any of the above embodiments can be applied to the following Node.js application embodiments. In the following Node.js application embodiments, the features and principles of static resource management that have been explained will not be repeated.

[0051] Figure 6 The main modules of the Node.js application in one embodiment are shown, referring to Figure 6 As shown, the Node.js application 800 of this embodiment includes: a middleware 810, which is used to respond to a static resource request initiated by a client and transmit a static resource request; an interceptor 820, which is used to search the cache for static resource data that matches the static resource request according to the static resource request, and if so, obtain the matching static resource data and load it to the view template engine 840, otherwise transmit the static resource request; a controller 830, which is used to obtain a service object by dependency injection when a static resource request is received, obtain static resource data according to the service object, and call a routing processing function to load the obtained static resource data into the view template engine 840; the view template engine 840 is used to render and generate a static page on the client according to the received static resource data.

[0052] Furthermore, the Node.js application may also include modules for implementing other process steps of the above-mentioned static resource management method embodiments. For example, the specific architecture of the Node.js application can be found in Figure 2 As shown, the specific principles of each module can refer to the description of the above-mentioned static resource management method embodiments, and will not be repeated here.

[0053] The Node.js application of the present invention can achieve efficient rendering of static pages and personalized management and flexible maintenance of static resources, improve the development efficiency of static pages, and is particularly suitable for the management of static resources in multiple languages, solving the problems of low development efficiency of multi-language static pages and difficulty in personalized management and maintenance.

[0054] An embodiment of the present invention further provides an electronic device, including a processor and a memory, wherein executable instructions are stored in the memory, and when the executable instructions are executed by the processor, the static resource management method described in any of the above embodiments is implemented.

[0055] The electronic device of the present invention can realize efficient rendering of static pages and personalized management and flexible maintenance of static resources, improve the development efficiency of static pages, and is particularly suitable for the management of static resources in multiple languages, solving the problems of low development efficiency of multi-language static pages and difficulty in personalized management and maintenance.

[0056] Figure 7 is a schematic diagram of the structure of an electronic device in an embodiment of the present invention. It should be understood that: Figure 7 The modules are only schematically shown, and these modules may be virtual software modules or actual hardware modules. The combination and splitting of these modules and the addition of other modules are all within the protection scope of the present invention.

[0057] like Figure 7 As shown, the electronic device 600 is in the form of a general computing device. The components of the electronic device 600 include but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different platform components (including the storage unit 620 and the processing unit 610), a display unit 640, etc.

[0058] The storage unit stores program codes, which can be executed by the processing unit 610, so that the processing unit 610 executes the steps of the static resource management method described in any of the above embodiments. For example, the processing unit 610 can execute the following steps: Figure 1 Steps shown.

[0059] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .

[0060] The storage unit 620 may also include a program / utility 6204 having one or more program modules 6205, such program modules 6205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0061] Bus 630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0062] The electronic device 600 can also communicate with one or more external devices 700, which can be one or more of a keyboard, a pointing device, a Bluetooth device, etc. These external devices 700 enable the user to communicate interactively with the electronic device 600. The electronic device 600 can also communicate with one or more other computing devices, and the computer device shown includes a router and a modem. This communication can be performed through an input / output (I / O) interface 650. In addition, the electronic device 600 can also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN) and / or a public network, such as the Internet) through a network adapter 660. The network adapter 660 can communicate with other modules of the electronic device 600 through a bus 630. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms.

[0063] The embodiment of the present invention further provides a computer-readable storage medium for storing a program, which implements the static resource management method described in any of the above embodiments when the program is executed. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the static resource management method described in any of the above embodiments.

[0064] When the storage medium of the present invention is executed by a processor, it can achieve efficient rendering of static pages and personalized management and flexible maintenance of static resources, improve the development efficiency of static pages, and is particularly suitable for the management of static resources in multiple languages, solving the problems of low development efficiency of multi-language static pages and difficulty in personalized management and maintenance.

[0065] The storage medium may be a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the storage medium of the present invention is not limited thereto, and may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0066] The storage medium may be any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination thereof. More specific examples of readable storage media include, but are not limited to, an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0067] The readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a readable program code is carried. The data signal of this propagation may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by an instruction execution system, an apparatus, or a device or used in combination with it. The program code contained on the readable signal medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.

[0068] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device, such as through the Internet using an Internet service provider.

[0069] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.

Claims

1. A static resource management method, characterized in that: Based on a Node.js application, the Node.js application includes a middleware, an interceptor, a controller, a view template engine, and a unit function module, each of which stores corresponding static resource data in a key-value pair format, and the static resource management method includes: The middleware transmits the static resource request in response to the static resource request initiated by the client; The interceptor searches the cache for static resource data matching the static resource request according to the static resource request, and if so, obtains the matching static resource data and loads it into the view template engine, and if not, transmits the static resource request; When the controller receives the static resource request, it obtains the service object by means of dependency injection, obtains the corresponding static resource data from the corresponding unit function module according to the service object, and calls the routing processing function to load the obtained static resource data into the view template engine; The view template engine renders and generates a static page on the client according to the received static resource data; The Node.js application also includes a Shark platform and a static page module, the Shark platform supports multiple languages, and the static resource data is multi-language static resource data; The static resource management method further includes: The Shark platform receives page development data based on the static page module configuration, the page development data carries static resource data identified by a key, publishes a static page according to the page development data, and generates a unit function module according to the static resource data in the page development data; and / or The Shark platform receives page modification data based on the static page module configuration, the page modification data carries static resource data identified by a key, modifies the corresponding static page according to the page modification data, and modifies the corresponding unit function module according to the static resource data in the page modification data; The view template engine renders and generates multi-language static pages based on the multi-language static resource data.

2. The static resource management method according to claim 1, characterized in that: The middleware also records the first parameter information of the static resource request through EdgeLogger, and the interceptor also records the second parameter information of the static resource request through ES Logger; The first parameter information includes: request method, uniform resource locator, response time, request status and warning information; The second parameter information includes: cache information, locale, currency, response status and average response time.

3. The static resource management method according to claim 1, characterized in that: The Node.js application further includes a decorator, and the static resource management method further includes: The decorator performs routing decentralized processing on the routing processing function.

4. The static resource management method according to claim 1, characterized in that: The Node.js application further includes a filter, and the static resource management method further includes: The filter captures exception information of the middleware, the interceptor and the controller, and records the exception information through EdgeLogger.

5. A Node.js application, characterized in that: Based on the static resource management method according to any one of claims 1 to 4, the Node.js application includes: The middleware is used to transmit the static resource request in response to the static resource request initiated by the client; An interceptor is used to search the cache for static resource data matching the static resource request according to the static resource request, and if so, obtain the matching static resource data and load it into the view template engine; otherwise, transmit the static resource request; Unit function modules, each of which stores corresponding static resource data in the form of key-value pairs; The controller is used to obtain the service object by means of dependency injection when receiving the static resource request, obtain the corresponding static resource data from the corresponding unit function module according to the service object, and call the routing processing function to load the obtained static resource data into the view template engine; The view template engine is used to render and generate static pages on the client according to the received static resource data; Shark platform and static page module, the Shark platform supports multiple languages, and the static resource data is multi-language static resource data; Wherein, the Shark platform receives page development data based on the configuration of the static page module, the page development data carries static resource data identified by a key, publishes a static page according to the page development data, and generates a unit function module according to the static resource data in the page development data; and / or, the Shark platform receives page modification data based on the configuration of the static page module, the page modification data carries static resource data identified by a key, modifies the corresponding static page according to the page modification data, and modifies the corresponding unit function module according to the static resource data in the page modification data; The view template engine renders and generates multi-language static pages based on the multi-language static resource data.

6. An electronic device, characterized in that: include: A processor; a memory storing executable instructions; Wherein, when the executable instruction is executed by the processor, the static resource management method as described in any one of claims 1-4 is implemented.

7. A computer-readable storage medium for storing a program, characterized in that: When the program is executed by a processor, the static resource management method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Page loading method and device

    CN108287839A

  • Webpage rendering method and device, electronic equipment and computer readable storage medium

    CN113468456A