CN115242874B - Network request agent optimization method, system, equipment and storage medium in application development stage - Google Patents

Network request agent optimization method, system, equipment and storage medium in application development stage Download PDF

Info

Publication number
CN115242874B
CN115242874B CN202210813058.2A CN202210813058A CN115242874B CN 115242874 B CN115242874 B CN 115242874B CN 202210813058 A CN202210813058 A CN 202210813058A CN 115242874 B CN115242874 B CN 115242874B
Authority
CN
China
Prior art keywords
node process
domain name
service
proxy
browser
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210813058.2A
Other languages
Chinese (zh)
Other versions
CN115242874A (en
Inventor
陈天宇
夏仕凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Canglang Health Management Co ltd
Hangzhou Clove Health Management Co ltd
Hangzhou Lianke Meixun Biomedical Technology Co ltd
Guanlan Networks Hangzhou Co ltd
Original Assignee
Hangzhou Canglang Health Management Co ltd
Hangzhou Clove Health Management Co ltd
Hangzhou Lianke Meixun Biomedical Technology Co ltd
Guanlan Networks Hangzhou Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Canglang Health Management Co ltd, Hangzhou Clove Health Management Co ltd, Hangzhou Lianke Meixun Biomedical Technology Co ltd, Guanlan Networks Hangzhou Co ltd filed Critical Hangzhou Canglang Health Management Co ltd
Priority to CN202210813058.2A priority Critical patent/CN115242874B/en
Publication of CN115242874A publication Critical patent/CN115242874A/en
Application granted granted Critical
Publication of CN115242874B publication Critical patent/CN115242874B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/0876Network architectures or network communication protocols for network security for authentication of entities based on the identity of the terminal or configuration, e.g. MAC address, hardware or software configuration or device fingerprint
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Power Engineering (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Debugging And Monitoring (AREA)
  • Stored Programmes (AREA)

Abstract

The application relates to a network request agent optimization method, a system and a storage medium in an application development stage, wherein the method comprises the following steps: acquiring the flow corresponding to the browser service development domain name; matching the acquired flow according to the agent rule configuration file of the front-end project; and returning the matched local file or remote file to the browser service development domain name to finish the resource replacement of the service development domain name, so as to refresh the browser when the local code is changed and stored correspondingly by a front-end developer, wherein the resource under the current domain name is replaced by the resource in the current development stage. The scheme is realized based on the browser, and the core is the replacement of the return resource of the browser, so that the new and old front-end technical stacks can be compatible, the code debugging tool is standardized, applicable to any project and unified in multiple projects, and the problem of high hand cost caused by the fact that front-end research personnel need to learn multiple research and development modes simultaneously is solved.

Description

Network request agent optimization method, system, equipment and storage medium in application development stage
Technical Field
The application relates to the field of Web page research and development, in particular to a network request agent optimization method, a system and a storage medium in an application development stage.
Background
In the rapid development of the Web front-end in the last decade, the front-end development mode also enters a modern development mode due to the constantly changing technical stacks and architectures of the front-end. Taking the code debugging stage of the current front-end development as an example, the following conventional technical scheme is generally adopted to solve the debugging problem:
a weback-dev-server is used as a front-end development server, and a proxy test environment interface is supported to simulate test environment data so as to quickly respond to defect repair and characteristic change of a front-end function. But this solution has the following problems: because a local server is started and the identity is not trusted, the user needs to log in first, then copy cookies from the browser manually, and configure the cookies into a weback-dev-server configuration file, so that the operation is complicated and the efficiency is affected; moreover, when the old service is encountered, the scenario of the browser origin is checked due to safety consideration, and the scheme cannot complete normal function debugging, and at the moment, the scheme needs to be returned to the Charles scheme.
Traffic requests are intercepted locally using traffic interception software such as Charles. For some old businesses running in the production environment for a long time, the technical stack is still in a state of cutter cultivation and fire, front-end resources are built by means of a front-end packaging tool, and then generated resources and HTML are delivered to a back-end host. In this scenario, there is a lack of a front-end development server, so in the scenarios of front-end code-tuning, on-line bug quick positioning, etc., traffic needs to be proxied to the local development environment by means of Charles. However, this technique still has the following problems: the agent rule configuration of Charles configuration is complex, different front-end projects need to configure different rules, each time the rules need to be configured first and then developed, and great upper hand cost exists in the front-end research and development process, so that the front-end research and development efficiency is low. Charles occupies system resources, and the running time is long, so that the memory is often tensed, and the front-end research and development efficiency is further affected.
Disclosure of Invention
In order to solve the problems in the prior art, particularly when a weback-dev-server is used as a front-end development server, a user needs to log in first and then manually copy cookies from a browser to be configured in a weback-dev-server configuration file, and the operation is complicated, so that the efficiency is affected; moreover, when the old service is met, the normal function debugging cannot be completed by the scheme because of the security check of the browser origin, and at the moment, the scheme needs to be returned to the Charles scheme.
In a first aspect, the network request agent optimization method in the application development stage provided by the present application adopts the following technical scheme:
a network request agent optimization method of an application development stage comprises the following steps:
acquiring the flow corresponding to the browser service development domain name;
matching the acquired flow according to the agent rule configuration file of the front-end project;
and returning the matched local file or remote file to the browser service development domain name to finish the resource replacement of the service development domain name, so as to refresh the browser when the local code is changed and stored correspondingly by a front-end developer, wherein the resource under the current domain name is replaced by the resource in the current development stage.
By adopting the technical scheme, the flow corresponding to the browser service development domain name is obtained, the proxy rule configuration file of the front-end project is utilized for matching, and the matched local file or remote file is utilized for replacing resources of the testing environment corresponding to the browser service development domain name, so that when a local code is changed and stored in a corresponding function by a front-end developer, the browser is refreshed, and resources under the current domain name are replaced with resources in the current research and development stage. The scheme is realized based on a browser, and the core is the replacement of the return resource of the browser, so that the new and old front-end technical stacks can be compatible, and the scheme is a standardized code debugging tool which is applicable to any project and is unified by multiple projects (in the prior art, projects need to be in a weback-dev-server scheme, and projects need to be in a Charles scheme), and the scheme unifies the upper hand cost of front-end research personnel needing to learn the two research and development modes simultaneously; in addition, the application only depends on the authentication logic of the browser, and a browser cookie is not required to be configured to the weback-dev-server after the browser logs in to verify the identity, so that research, development and debugging are carried out, and a complex program which needs to log in to verify the identity when the weback-dev-server is used as a front-end development server can be omitted. Meanwhile, the problem of joint debugging blocking caused by inconsistent origin of some service-side checking http requests is also compatible, the method does not need to return to the Charles scheme, the login state uses a real environment, the service scene is attached to the maximum extent, and the research and development efficiency of function verification under the login scene is greatly improved. Therefore, the network request agent optimization method in the application development stage can better improve the development efficiency of front-end developers, reduce the cost of the upper hand, and simultaneously the developers do not need to pay attention to the difference of projects when developing the front-end application, so that the development joint debugging delivery application function is rapidly completed.
Preferably, the method further comprises:
running a server Node process and a client Node process, wherein the server Node process starts an http service on an address corresponding to a local proxy server and resides in a background for acquiring traffic corresponding to a browser service development domain name; the client Node processes are used for reading the proxy rule configuration file of the front-end project and reporting the proxy rule configuration file to the server Node process, wherein one client Node process corresponds to one front-end project; and the service side Node process matches the acquired flow according to the proxy rule configuration file of the front-end project.
By adopting the technical scheme, two Node processes, namely a server Node process and a client Node process, are operated, and the server Node process starts an http service on an address corresponding to a local proxy server and resides in a background for acquiring traffic corresponding to a browser service development domain name; the client Node process is used for reading the proxy rule configuration file of the front-end project and reporting the proxy rule configuration file to the server Node process, so that the problem that the configuration of the proxy rule of the Charles configuration is complex, different front-end projects need to be configured with different rules, each time the rule needs to be configured first and then developed, and the front-end development process has great hand-up cost, so that the front-end development efficiency is low can be solved. Therefore, the cost of the upper hand in the front-end research and development process can be greatly reduced, and the front-end research and development efficiency is improved.
Preferably, the method further comprises: performing heartbeat connection on the server Node process and the client Node process based on socket; if the service Node process detects that no client exists currently, the proxy configuration rule is dynamically unloaded.
By adopting the technical scheme, two Node processes, namely a server Node process and a client Node process, are operated, and heartbeat connection is carried out on the server Node process and the client Node process based on socket, so that proxy configuration can be started up for hot loading/unloading along with a plurality of front-end projects (namely, if the front-end projects are not developed, after the associated client Node is closed, the client Node process and the server Node process have no interaction, the server Node process unloads corresponding proxy configuration rules), and a developer does not need to care about proxy rules per se when a plurality of front-end projects are simultaneously developed, thereby improving development and debugging efficiency; meanwhile, because the server Node process and the client Node process perform heartbeat connection based on socket to realize a dynamic loading mechanism of proxy rule configuration, compared with Charles (memory is always increased and not released along with the increase of operation projects), the system memory is occupied to be smaller, and the problem of overhigh memory use of a developer can be remarkably reduced under the conditions of long-time development and multi-project development.
Preferably, the method further comprises:
when the command line is started, the client Node process automatically detects whether the current front-end project has an existing proxy rule configuration file, and if so, the client Node process directly reports the current front-end project to the server Node process; otherwise, automatically generating a preset file of the proxy rule, and after relevant configuration is carried out by the research personnel, starting the client Node process next time to report the proxy rule to the server Node process.
By adopting the technical scheme, the problem of repeated configuration rules of the Charles research and development function can be solved, and the occupied system memory is reduced.
Preferably, the method further comprises: when starting agent, the client Node process detects whether there is a service end of resident background; if yes, reporting the proxy rule configuration file only; otherwise, starting a service end Node process, starting an http service on an address corresponding to the local proxy server and residing in the background, and then reporting the proxy rule configuration file by the client end Node process.
By adopting the technical scheme, only one server Node process is ensured to be started, so that compared with Charles (the memory is increased along with the increase of operation projects and is not released), the memory occupied by the system is smaller, and the problem of overhigh memory use of a development machine can be remarkably reduced under the conditions of long-time development and multi-project development.
Preferably, the returning the matched local file to the browser service development domain name includes:
returning the corresponding file under the local directory searched by the fs module of the Node process to the server Node process; and then returning the corresponding file as network resource to the browser service development domain name through the Node http module.
Preferably, the returning the matched remote file to the browser service development domain name includes:
the service side Node process sends a corresponding file returned by another http service started by the weback to the browser service development domain name; and the server Node process forwards the http request to another http service started by the weback according to the proxy configuration rule.
In a second aspect, the network request agent optimization system in the application development stage provided in the present application adopts the following technical scheme:
a network request proxy optimization system of an application development phase, comprising:
the flow obtaining module is used for obtaining the flow corresponding to the browser service development domain name;
the data matching module is used for matching the acquired flow according to the proxy rule configuration file of the front-end project;
and the data feedback module is used for returning the matched local file or remote file to the browser service development domain name to finish the resource replacement of the service development domain name, and refreshing the browser when a front-end research and development personnel changes and saves the local code in a corresponding function, wherein the resource under the current domain name is replaced with the resource in the current research and development stage.
In a third aspect, the present application provides an electronic device, which adopts the following technical scheme:
an electronic device comprising a memory and a processor, the memory having stored thereon a computer program capable of being loaded and executed by the processor to carry out any of the methods described above.
In a fourth aspect, the present application provides a computer readable storage medium, which adopts the following technical scheme:
a computer readable storage medium storing a computer program capable of being loaded by a processor and executing a method embodying any one of the preceding methods.
In summary, the present application includes the following beneficial technical effects:
by adopting the technical scheme, the flow corresponding to the browser service development domain name is obtained, the proxy rule configuration file of the front-end project is utilized for matching, and the matched local file or remote file is utilized for replacing resources of the testing environment corresponding to the browser service development domain name, so that when a local code is changed and stored in a corresponding function by a front-end developer, the browser is refreshed, and resources under the current domain name are replaced with resources in the current research and development stage. The scheme is realized based on a browser, and the core is the replacement of the return resource of the browser, so that the new and old front-end technical stacks can be compatible, and the scheme is a standardized code debugging tool which is applicable to any project and is unified by multiple projects (in the prior art, projects need to be in a weback-dev-server scheme, and projects need to be in a Charles scheme), and the scheme unifies the upper hand cost of front-end research personnel needing to learn the two research and development modes simultaneously; in addition, the application only depends on the authentication logic of the browser, and a browser cookie is not required to be configured to the weback-dev-server after the browser logs in to verify the identity, so that research, development and debugging are carried out, and a complex program which needs to log in to verify the identity when the weback-dev-server is used as a front-end development server can be omitted. Meanwhile, the problem of joint debugging blocking caused by inconsistent origin of some service-side checking http requests is also compatible, the method does not need to return to the Charles scheme, the login state uses a real environment, the service scene is attached to the maximum extent, and the research and development efficiency of function verification under the login scene is greatly improved. Therefore, the network request agent optimization method in the application development stage can better improve the development efficiency of front-end developers, reduce the cost of the upper hand, and simultaneously the developers do not need to pay attention to the difference of projects when developing the front-end application, so that the development joint debugging delivery application function is rapidly completed.
Drawings
FIG. 1 is a method flow diagram of one embodiment of the present application.
Detailed Description
The present application is described in further detail below in conjunction with fig. 1.
The embodiment of the application discloses a network request agent optimization method in an application development stage. Referring to fig. 1, a network request agent optimization method in an application development stage includes the following steps:
s1, obtaining flow corresponding to a browser service development domain name;
in the implementation, a flow interception plug-in (such as switchyomiega) can be installed in a browser, and a flow interception situation mode is configured for the flow interception plug-in; the configuration of the traffic interception situation mode comprises setting the name (such as proxy) of the traffic interception situation mode, the protocol (such as http) of the local proxy server to which the traffic is forwarded, the address (such as localhost) and the port (such as 3070) and storing. And then switching the flow interception plug-in of the browser to a set flow interception situation mode (namely switching the flow interception situation mode of the switchyOmega browser plug-in to proxy, which represents that all network requests under the current access domain name are forwarded to a proxy server of the local http:// localhost 3070) at the moment, and acquiring the flow corresponding to the browser service development domain name by utilizing a Node process. Specifically, a server Node process and a client Node process are operated, and the server Node process starts an http service (for example, starts an http service at an http:// localhost 3070 address) at an address corresponding to a local proxy server, and resides in a background to obtain traffic corresponding to a browser service development domain name.
S2, matching the acquired flow according to the agent rule configuration file of the front-end project;
in the proxy rule configuration file of the front-end project, a resource proxy matching the specified domain name is defined to a local file or a remote file (i.e. other servers started by weback). One implementation scheme is that a client Node process is adopted to read a proxy rule configuration file of a front-end project and report the proxy rule configuration file to a server Node process, wherein one client Node process corresponds to one front-end project, namely one client Node process is used for reading and reporting the proxy rule configuration file of one front-end project. In another implementation, the agent rule configuration files of all front-end projects are uniformly stored in a certain fixed position, and then the agent rule configuration files of all front-end projects are obtained from the fixed position set.
In order to ensure the real-time relevance of development projects and agent rules and avoid the behavior that the unrestricted starting client Node process occupies memory, in the embodiment of the application, heartbeat connection can be performed on the server Node process and the client Node process based on socket; if the service Node process detects that no client exists currently, the proxy configuration rule is dynamically unloaded.
And/or
When the command line is started, the client Node process automatically detects whether the current front-end project has an existing proxy rule configuration file, and if so, the client Node process directly reports the current front-end project to the server Node process; otherwise, automatically generating a preset file of the proxy rule, and after relevant configuration is carried out by the research personnel, starting the client Node process next time to report the proxy rule to the server Node process. The method is used for reducing the initial access cost of the research personnel.
And/or
When starting agent, the client Node process detects whether there is a service end of resident background; if yes, reporting the proxy rule configuration file only; otherwise, starting a service end Node process, starting an http service on an address corresponding to the local proxy server and residing in the background, and then reporting the proxy rule configuration file by the client end Node process. And the computer resource waste caused by repeatedly starting the server is avoided.
And S3, returning the matched local file or remote file to the browser service development domain name to finish the resource replacement of the service development domain name (namely, returning a function operation dependent code) so as to refresh the browser when a front-end developer changes and saves the local code in a corresponding function, wherein the resource under the current domain name is replaced with the resource in the current development stage.
Specifically, the returning the matched local file to the browser service development domain name includes:
returning the corresponding file under the local directory searched by the fs module of the Node process to the server Node process; and then returning the corresponding file as network resource to the browser service development domain name through the Node http module.
The returning the matched remote file to the browser service development domain name comprises the following steps:
the service side Node process sends a corresponding file returned by another http service started by the weback to the browser service development domain name; and the server Node process forwards the http request to another http service started by the weback according to the proxy configuration rule.
The embodiment of the application also discloses a network request agent optimization system in the application development stage. A network request proxy optimization system of an application development phase, comprising:
the flow obtaining module is used for obtaining the flow corresponding to the browser service development domain name;
the data matching module is used for matching the acquired flow according to the proxy rule configuration file of the front-end project;
and the data feedback module is used for returning the matched local file or remote file to the browser service development domain name to finish the resource replacement of the service development domain name, and refreshing the browser when a front-end research and development personnel changes and saves the local code in a corresponding function, wherein the resource under the current domain name is replaced with the resource in the current research and development stage.
It will be apparent to those skilled in the art that the above-described modules are merely illustrated in terms of division for convenience and brevity, and that in practical applications, the above-described functions may be distributed as needed by different modules, i.e., the internal structure of the apparatus may be divided into different modules to perform all or part of the above-described functions.
The embodiment of the application also discloses electronic equipment. An electronic device comprising a memory and a processor, the memory having stored thereon a computer program capable of being loaded and executed by the processor to implement any of the methods described above.
The electronic device may be an electronic device such as a desktop computer, a notebook computer, or a cloud server, and the electronic device includes, but is not limited to, a processor and a memory, for example, the electronic device may further include an input/output device, a network access device, a bus, and the like.
A processor in the present application may include one or more processing cores. The processor performs the various functions of the present application and processes the data by executing or executing instructions, programs, code sets, or instruction sets stored in memory, calling data stored in memory. The processor may be at least one of an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a digital signal processor (Digital Signal Processor, DSP), a digital signal processing device (Digital Signal Processing Device, DSPD), a programmable logic device (Programmable Logic Device, PLD), a field programmable gate array (Field Programmable Gate Array, FPGA), a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, and a microprocessor. It will be appreciated that the electronic device for implementing the above-mentioned processor function may be other for different apparatuses, and embodiments of the present application are not specifically limited.
The memory may be an internal storage unit of the electronic device, for example, a hard disk or a memory of the electronic device, or may be an external storage device of the electronic device, for example, a plug-in hard disk, a Smart Memory Card (SMC), a secure digital card (SD), or a flash memory card (FC) provided on the electronic device, or the like, and may be a combination of the internal storage unit of the electronic device and the external storage device, where the memory is used to store a computer program and other programs and data required by the electronic device, and the memory may be used to temporarily store data that has been output or is to be output, which is not limited in this application.
The embodiment of the application also discloses a computer readable storage medium. A computer readable storage medium storing a computer program capable of being loaded by a processor and executing any one of the methods described above.
Those skilled in the art will appreciate that implementing all or part of the above-described methods may be accomplished by way of a computer program, which may be stored on a non-transitory computer readable storage medium and which, when executed, may comprise the steps of the above-described embodiments of the methods. Any reference to memory, storage, database, or other medium used in the various embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The foregoing are all preferred embodiments of the present application, and are not intended to limit the scope of the present application in any way, therefore: all equivalent changes according to the method and principle of the present application should be covered in the protection scope of the present application.

Claims (6)

1. A network request agent optimization method in an application development stage is characterized in that: the method comprises the following steps:
acquiring the flow corresponding to the browser service development domain name; specifically, the method for obtaining the flow corresponding to the browser service development domain name by using the Node process comprises the following steps: running a server Node process and a client Node process, wherein the server Node process starts an http service on an address corresponding to a local proxy server and resides in a background for acquiring traffic corresponding to a browser service development domain name; the client Node processes are used for reading the proxy rule configuration file of the front-end project and reporting the proxy rule configuration file to the server Node process, wherein one client Node process corresponds to one front-end project;
the service end Node process matches the acquired flow according to the proxy rule configuration file of the front-end project;
returning the matched local file or remote file to the browser service development domain name to finish the resource replacement of the service development domain name, so as to refresh the browser when the local code is changed and stored correspondingly by a front-end developer, wherein the resource under the current domain name is replaced by the resource in the current development stage;
performing heartbeat connection on the server Node process and the client Node process based on socket; if the service side Node process detects that no client side exists currently, dynamically unloading the proxy rule;
the method further comprises the steps of:
when the command line is started, the client Node process automatically detects whether the current front-end project has an existing proxy rule configuration file, and if so, the client Node process directly reports the current front-end project to the server Node process; otherwise, automatically generating a preset file of the proxy rule, and reporting the proxy rule to the server Node process when the client Node process is started next time after the research personnel perform relevant configuration;
when starting agent, the client Node process detects whether there is a service end of resident background; if yes, reporting the proxy rule configuration file only; otherwise, starting a service end Node process, starting an http service on an address corresponding to the local proxy server and residing in the background, and then reporting the proxy rule configuration file by the client end Node process.
2. The method for optimizing network request proxy of application development stage according to claim 1, wherein said returning the matched local file to the browser service development domain name comprises:
returning the corresponding file under the local directory searched by the fs module of the client Node process to the server Node process; and then returning the corresponding file as network resource to the browser service development domain name through the Node http module.
3. The method for optimizing network request proxy of application development stage according to claim 1, wherein returning the matched remote file to the browser service development domain name comprises:
the service side Node process sends a corresponding file returned by another http service started by the weback to the browser service development domain name; and the server Node process forwards the http request to another http service started by the weback according to the proxy rule.
4. A network request agent optimization system in an application development stage, characterized in that: comprising the following steps:
the flow obtaining module is used for obtaining the flow corresponding to the browser service development domain name; specifically, a server Node process and a client Node process are operated, wherein the server Node process starts an http service on an address corresponding to a local proxy server and resides in a background for acquiring traffic corresponding to a browser service development domain name; the client Node processes are used for reading the proxy rule configuration file of the front-end project and reporting the proxy rule configuration file to the server Node process, wherein one client Node process corresponds to one front-end project;
the data matching module is used for matching the acquired flow according to the proxy rule configuration file of the front-end project by the service-end Node process;
the data feedback module is used for returning the matched local file or remote file to the browser service development domain name to finish the resource replacement of the service development domain name, and refreshing the browser when a current end research and development personnel changes and saves the local code in a corresponding function, wherein the resource under the current domain name is replaced with the resource in the current research and development stage;
the heartbeat connection processing and agent rule unloading module is used for carrying out heartbeat connection on the server Node process and the client Node process based on socket; if the service side Node process detects that no client side exists currently, dynamically unloading the proxy rule;
the agent rule configuration file detection module is used for automatically detecting whether the existing agent rule configuration file exists in the current front-end project or not by the client Node process when the command line is started, and if so, reporting the existing agent rule configuration file to the server Node process directly; otherwise, automatically generating a preset file of the proxy rule, and reporting the proxy rule to the server Node process when the client Node process is started next time after the research personnel perform relevant configuration;
the client Node process detects whether a server of a resident background exists currently or not when the proxy is started; if yes, reporting the proxy rule configuration file only; otherwise, starting a service end Node process, starting an http service on an address corresponding to the local proxy server and residing in the background, and then reporting the proxy rule configuration file by the client end Node process.
5. An electronic device comprising a memory and a processor, the memory having stored thereon a computer program capable of being loaded and executed by the processor to implement the method of any one of claims 1 to 3.
6. A computer readable storage medium, characterized in that a computer program enabling a processor to load and execute the method of any one of claims 1 to 3 is stored.
CN202210813058.2A 2022-07-12 2022-07-12 Network request agent optimization method, system, equipment and storage medium in application development stage Active CN115242874B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210813058.2A CN115242874B (en) 2022-07-12 2022-07-12 Network request agent optimization method, system, equipment and storage medium in application development stage

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210813058.2A CN115242874B (en) 2022-07-12 2022-07-12 Network request agent optimization method, system, equipment and storage medium in application development stage

Publications (2)

Publication Number Publication Date
CN115242874A CN115242874A (en) 2022-10-25
CN115242874B true CN115242874B (en) 2023-05-12

Family

ID=83671267

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210813058.2A Active CN115242874B (en) 2022-07-12 2022-07-12 Network request agent optimization method, system, equipment and storage medium in application development stage

Country Status (1)

Country Link
CN (1) CN115242874B (en)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160259509A1 (en) * 2015-03-02 2016-09-08 Warhead, Inc. Backend-to-frontend website development
CN108958788A (en) * 2018-07-10 2018-12-07 平安科技(深圳)有限公司 The method, apparatus and computer equipment of automatic synchronization refreshing browser
CN110377283B (en) * 2019-07-08 2022-10-11 北京亚鸿世纪科技发展有限公司 Method for realizing and synchronizing front-end effective data during Web front-end and back-end separation development
CN113836469A (en) * 2021-09-29 2021-12-24 上海掌门科技有限公司 Website front-end development method and equipment

Also Published As

Publication number Publication date
CN115242874A (en) 2022-10-25

Similar Documents

Publication Publication Date Title
CN112637346A (en) Proxy method, device, proxy server and storage medium
CN110764998B (en) Data comparison method, device, equipment and storage medium based on Django framework
CN109857404B (en) SDK interface packaging method and device, storage medium and electronic equipment
CN110704312B (en) Method, device, computer equipment and storage medium for pressure test
CN110515795B (en) Big data component monitoring method and device and electronic equipment
US10803166B1 (en) Automated determination of application privileges
CN106156231A (en) A kind of website disaster recovery method, Apparatus and system
WO2019085290A1 (en) Test preparation method and apparatus, terminal device, and storage medium
US20190149571A1 (en) Method and device for repairing page vulnerability
CN109582583B (en) Software testing method, device, computer equipment and storage medium
CN113986733A (en) Jar package based performance test method, device, equipment and storage medium
CN112699034B (en) Virtual login user construction method, device, equipment and storage medium
CN116743619B (en) Network service testing method, device, equipment and storage medium
CN113392028A (en) Distributed test system and control method
CN115242874B (en) Network request agent optimization method, system, equipment and storage medium in application development stage
CN116225622A (en) Docker-based PaaS application parameter template testing method
CN114385498A (en) Performance test method, system, computer equipment and readable storage medium
US20230088318A1 (en) Remotely healing crashed processes
CN115374098A (en) High concurrent payment order anti-duplication method, apparatus, system, device, medium, and program product
CN114356446A (en) Method, device and equipment for processing inter-process event and storage medium
CN111475400A (en) Verification method of service platform and related equipment
CN110874238A (en) Online service updating method and device
CN112560035B (en) Application detection method, device, equipment and storage medium
CN111488230A (en) Method and device for modifying log output level, electronic equipment and storage medium
CN110647526B (en) Batch data processing method, device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant