CN113050923A - Front-end interface data simulation method, device and system - Google Patents

Front-end interface data simulation method, device and system Download PDF

Info

Publication number
CN113050923A
CN113050923A CN202110429294.XA CN202110429294A CN113050923A CN 113050923 A CN113050923 A CN 113050923A CN 202110429294 A CN202110429294 A CN 202110429294A CN 113050923 A CN113050923 A CN 113050923A
Authority
CN
China
Prior art keywords
interface
server
mockserver
simulation
data
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.)
Granted
Application number
CN202110429294.XA
Other languages
Chinese (zh)
Other versions
CN113050923B (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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202110429294.XA priority Critical patent/CN113050923B/en
Publication of CN113050923A publication Critical patent/CN113050923A/en
Application granted granted Critical
Publication of CN113050923B publication Critical patent/CN113050923B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a front-end interface data simulation method, a device and a system, which can be used in the financial field or other technical fields, and the method comprises the following steps: receiving an interface request initiated by a front end; and if the interface requested in the interface request is bound with a MockServer server, forwarding the interface request to the MockServer server so that the MockServer server returns the analog data corresponding to the interface requested in the interface request to the front end, wherein the MockServer server is deployed locally at the front end. The invention provides a simulation data scheme which is convenient to debug and does not cause compatibility problem, and is beneficial to improving the front-end development efficiency.

Description

Front-end interface data simulation method, device and system
Technical Field
The invention relates to the technical field of front-end development, in particular to a front-end interface data simulation method, device and system.
Background
In the context of front-back separation, the front-back connection usually involves only an interface, and therefore, when developing the front-end component, the front-end component is usually developed separately by means of analog data. Js is directly introduced into front-end engineering to realize most of currently used analog data schemes, and the principle of the method is to intercept all requests and proxy the requests to the local in a mode of rewriting XMLHttpRequest objects, so that a browser console cannot monitor any request during debugging. This approach presents two problems: 1. the debugging is inconvenient. Because no request can be seen in the browser console, the user wants to know what data is returned by the corresponding interface only by means of Console.log or manual Debug; 2 compatibility issues. Js is realized by rewriting XMLHttpRequest objects, so that some bottom layers depend on the XMLHttpRequest objects to generate compatibility problems.
Therefore, the prior art lacks an analog data scheme that is easy to debug without creating compatibility problems.
Disclosure of Invention
The present invention provides a method, an apparatus, and a system for front-end interface data simulation to solve the technical problems in the background art.
In order to achieve the above object, according to one aspect of the present invention, there is provided a front-end interface data simulation method, including:
receiving an interface request initiated by a front end;
and if the interface requested in the interface request is bound with a MockServer server, forwarding the interface request to the MockServer server so that the MockServer server returns the analog data corresponding to the interface requested in the interface request to the front end, wherein the MockServer server is deployed locally at the front end.
Optionally, before the receiving the interface request initiated by the front end, the method further includes:
and constructing the front end and simultaneously starting the MockServer server, wherein the MockServer server is bound with a target interface of the front end when being started, and loads analog data corresponding to the target interface from each function code file of the front end to local for caching.
Optionally, the MockServer server monitors the analog data corresponding to the target interface in each function code file of the front end, empties the analog data of the local cache when monitoring that the data changes, and then loads the analog data corresponding to the target interface from each function code file of the front end to the local cache.
Optionally, the constructing the front end and starting the MockServer server at the same time specifically includes:
and constructing the front end through a webpack tool and simultaneously starting the MockServer server through a hook function by utilizing the webpack-dev-server function of the webpack tool.
In order to achieve the above object, according to another aspect of the present invention, there is provided a front-end interface data simulation apparatus including:
the interface request receiving module is used for receiving an interface request initiated by a front end;
and the interface request forwarding module is used for forwarding the interface request to the MockServer server if the interface requested in the interface request is bound with the MockServer server so as to enable the MockServer server to return the analog data corresponding to the interface requested in the interface request to the front end, wherein the MockServer server is deployed locally at the front end.
Optionally, the front-end interface data simulation apparatus further includes:
and the starting module is used for constructing the front end and simultaneously starting the MockServer server, wherein the MockServer server is bound with a target interface of the front end when being started, and loads the simulation data corresponding to the target interface from each function code file of the front end to be locally cached.
Optionally, the MockServer server monitors the analog data corresponding to the target interface in each function code file of the front end, empties the analog data of the local cache when monitoring that the data changes, and then loads the analog data corresponding to the target interface from each function code file of the front end to the local cache.
Optionally, the starting module is specifically configured to build the front end by using a webpack tool, and start the MockServer server by using a webpack-dev-server function of the webpack tool through a hook function.
In order to achieve the above object, according to another aspect of the present invention, there is provided a front-end interface data simulation system, including: the system comprises a webpack tool and a MockServer server, wherein the MockServer server is deployed at the front end locally;
the webpack tool is used for forwarding an interface request to the MockServer server when an interface requested in the interface request initiated by the front end is bound with the MockServer server;
and the MockServer server is used for returning the simulation data corresponding to the interface requested in the interface request to the front end.
Optionally, the webpack tool is further configured to construct the front end and start the MockServer server at the same time; the MockServer server is also used for binding with a target interface of the front end during starting, and loading simulation data corresponding to the target interface from each function code file of the front end to local cache.
Optionally, the MockServer server is further configured to monitor analog data corresponding to the target interface in each function code file of the front end, empty analog data of a local cache when a data change is monitored, and load analog data corresponding to the target interface from each function code file of the front end to the local cache.
Optionally, the webpack tool is specifically configured to start the MockServer server by using a webpack-dev-server function through a hook function while constructing the front end.
In order to achieve the above object, according to another aspect of the present invention, there is also provided a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps in the front-end interface data simulation method when executing the computer program.
In order to achieve the above object, according to another aspect of the present invention, there is also provided a computer-readable storage medium storing a computer program which, when executed in a computer processor, implements the steps in the above front-end interface data simulation method.
The invention has the beneficial effects that: the method comprises the steps that a MockServer server is locally deployed at a front end, an interface request is forwarded to the MockServer server when an interface requested in the interface request initiated by the front end is bound with the MockServer server, and then the MockServer server returns analog data corresponding to the interface requested in the interface request to the front end. Therefore, developers can conveniently write the rules of the simulation data in a familiar code mode at the MockServer server in the front-end engineering, do not need to log in an additional simulation data platform to perform complicated interface registration operation, can directly obtain the data returned by the interface from the MockServer server, and is convenient for debugging. When the interface is adjusted, the invention can also conveniently adjust the codes in the project, thereby reducing the burden of developers. In addition, the method does not rewrite the XMLHttpRequest object, thereby avoiding the compatibility problem. Therefore, the invention provides a simulation data scheme which is convenient to debug and does not generate compatibility problem, and is beneficial to improving the front-end development efficiency.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts. In the drawings:
FIG. 1 is a flow chart of a method for simulating data of a front-end interface according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a thermal update process according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of the interaction between a front-end interface data simulation system and a front-end according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a simulation data service initiation process according to an embodiment of the present invention;
FIG. 5 is a schematic diagram illustrating a simulation data hot-update process according to an embodiment of the present invention;
FIG. 6 is a block diagram of a front-end interface data simulator according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of a computer apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
It should be noted that the terms "comprises" and "comprising," and any variations thereof, in the description and claims of the present invention and the above-described drawings, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that the embodiments and features of the embodiments may be combined with each other without conflict. The present invention will be described in detail below with reference to the embodiments with reference to the attached drawings.
One aspect of the present invention provides a front-end interface data simulation system, including: the system comprises a webpack tool and a MockServer server, wherein the MockServer server is deployed at the front end locally.
The webpack tool is used for forwarding an interface request to the MockServer server when an interface requested in the interface request initiated by the front end is bound with the MockServer server. In an embodiment of the present invention, the webpack tool is a typical front-end baling tool.
And the MockServer server is used for returning the simulation data corresponding to the interface requested in the interface request to the front end. Specifically, the MockServer server determines the analog data corresponding to the interface requested in the interface request from a local cache, and then returns the corresponding analog data to the front end.
Fig. 3 is a schematic diagram illustrating interaction between a front-end interface data simulation system and a front-end according to an embodiment of the present invention, and as shown in fig. 3, in the embodiment of the present invention, the webpack tool is further configured to construct the front-end and start the MockServer server at the same time. Specifically, the webpack tool can utilize the webpack-dev-server function to start the MockServer server through a hook function while constructing the front end. The webpack tool can construct a front end according to each function code file of the front end, and the front end can be a WEB front end or other types of front ends.
The MockServer server is also used for binding with a target interface of the front end during starting, and loading simulation data corresponding to the target interface from each function code file of the front end to local cache. In the embodiment of the invention, the simulation data uses a specific name and is dispersed in each function code folder at the front end, so that the relevant codes of each function are converged at one position, and the simulation data is convenient for developers to edit and transplant.
The webpack tool stores binding information of the MockServer server and the interfaces, and then interface request forwarding is carried out according to the binding information, namely, which interfaces are to be intercepted to the MockServer server are determined according to the binding information.
In this embodiment of the present invention, the MockServer server is further configured to monitor analog data corresponding to the target interface in each function code file of the front end (the analog data usually adopts a specific file name, for example, viewmock. js, to facilitate monitoring), and when a change of the data is monitored, empty the analog data of the local cache first, and then load the analog data corresponding to the target interface from each function code file of the front end to the local cache.
Therefore, the invention realizes a local MockServer at the front end, and the MockServer server is started along with the start of the front-end engineering by utilizing the webpack-dev-server function provided by the webpack tool commonly used at the front end. The MockServer server monitors the corresponding analog data file, and when the analog data is modified, the interface mock information is automatically refreshed to realize the hot update effect.
Fig. 4 is a schematic diagram of an analog data service start process according to an embodiment of the present invention, as shown in fig. 4, when a front-end project is started, first, along with execution of a front-end development mode instruction, a webpack tool starts a development mode of the front-end project, that is, a front end is constructed, during starting, the webpack performs a webpack-dev-server function, and then, through a hook function, the webpack-dev-server starts a MockServer server.
And secondly, three tasks can be finished in the MockServer server, namely binding a corresponding interface, loading the analog data file, registering interface information and setting monitoring on the analog data file. After the above-mentioned content is executed, the beginning of the MockServer server is completed, and at this moment, a developer can debug the front-end interface in the browser, and the MockServer server can also make a preset response, and can also see the request information sent really in the browser console. Therefore, developers can write simulation data in front-end engineering conveniently, and real message feedback can be checked conveniently in a browser console during debugging.
When a developer modifies or adds a new simulation data file to a simulation data file in a front-end project, a hot update action is triggered, and a specific execution flow is shown in fig. 5. Because the working mechanism of the MockServer server can store the cache information of the loaded file, and the execution of the file loading instruction can cause the hit cache to suspend the loading process, so that the latest data cannot take effect, whether the cache information exists needs to be judged first, and if the cache information exists, the corresponding cache needs to be cleared.
In another aspect of the present invention, a front-end interface data simulation method is provided, and because a principle of solving a problem of the front-end interface data simulation method is similar to that of the front-end interface data simulation system, reference may be made to the embodiment of the front-end interface data simulation system in the embodiment of the front-end interface data simulation method, and repeated details are not described again.
Fig. 1 is a flowchart of a front-end interface data simulation method according to an embodiment of the present invention, and an implementation subject of the front-end interface data simulation method is a webpack tool in the front-end interface data simulation system, as shown in fig. 1, the front-end interface data simulation method according to the embodiment includes step S101 and step S102.
Step S101, receiving an interface request initiated by a front end.
Step S102, if the interface requested in the interface request is bound with a MockServer server, the interface request is forwarded to the MockServer server so that the MockServer server returns the analog data corresponding to the interface requested in the interface request to the front end, wherein the MockServer server is deployed locally at the front end.
In an embodiment of the present invention, before the step S101, the method of the present invention further includes the steps of:
and constructing the front end and simultaneously starting the MockServer server, wherein the MockServer server is bound with a target interface of the front end when being started, and loads analog data corresponding to the target interface from each function code file of the front end to local for caching.
The main implementation of this step is the webpack tool in the front-end interface data simulation system.
In an embodiment of the present invention, the constructing the front end and starting the MockServer server at the same time specifically includes: and constructing the front end through a webpack tool and simultaneously starting the MockServer server through a hook function by utilizing the webpack-dev-server function of the webpack tool.
Fig. 2 is a schematic diagram of a hot-update process according to an embodiment of the present invention, and as shown in fig. 2, the hot-update process according to the present invention includes step S201 and step S202.
Step S201, the MockServer server monitors the analog data corresponding to the target interface in each function code file of the front end.
Step S202, emptying the simulation data of the local cache when monitoring the data change, and then loading the simulation data corresponding to the target interface from each function code file of the front end to the local cache.
As can be seen from the above embodiments, the present invention achieves at least the following advantageous effects:
1. the invention solves the problem of third-party library compatibility and the debugging problem of developers caused by rewriting XMLHttpRequest objects in the mock. Because the XMLHttpRequest object is not rewritten in the invention, the problem of compatibility of the development stage of a third-party library related to the XMLHttpRequest object is avoided. Meanwhile, because the browser sends out a real request, all request information can be seen in the browser console, developers can conveniently Debug the browser console, complex Console.log and Debug operations are not needed, and development efficiency is improved.
2. The invention solves the problem of development cost brought by an independent simulation data platform. After the scheme of the invention is used, developers can conveniently complete the rule writing of the simulation data in a familiar code mode in the project, and do not need to log in an additional simulation data platform to perform complicated interface registration operation. And when the interface is adjusted, the code can be conveniently adjusted in the project, so that the burden of developers is reduced.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
Based on the same inventive concept, an embodiment of the present invention further provides a front-end interface data simulation apparatus, which can be used to implement the front-end interface data simulation method described in the foregoing embodiment, as described in the following embodiments. Because the principle of the front-end interface data simulation device for solving the problems is similar to the front-end interface data simulation method, the embodiment of the front-end interface data simulation device can refer to the embodiment of the front-end interface data simulation method, and repeated parts are not described again. As used hereinafter, the term "unit" or "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 6 is a block diagram of a front-end interface data simulation apparatus according to an embodiment of the present invention, and as shown in fig. 6, the front-end interface data simulation apparatus according to the embodiment of the present invention includes:
the interface request receiving module 1 is used for receiving an interface request initiated by a front end;
and the interface request forwarding module 2 is configured to forward the interface request to a MockServer server if an interface requested in the interface request is bound with the MockServer server, so that the MockServer server returns analog data corresponding to the interface requested in the interface request to the front end, where the MockServer server is deployed locally at the front end.
In an embodiment of the present invention, the front-end interface data simulation apparatus of the present invention further includes:
and the starting module is used for constructing the front end and simultaneously starting the MockServer server, wherein the MockServer server is bound with a target interface of the front end when being started, and loads the simulation data corresponding to the target interface from each function code file of the front end to be locally cached.
In an embodiment of the present invention, the MockServer server monitors the analog data corresponding to the target interface in each function code file of the front end, and empties the analog data of the local cache when monitoring that the data changes, and then loads the analog data corresponding to the target interface from each function code file of the front end to the local cache.
In an embodiment of the present invention, the starting module is specifically configured to build the front end by using a webpack tool, and start the MockServer server by using a webpack-dev-server function of the webpack tool through a hook function.
To achieve the above object, according to another aspect of the present application, there is also provided a computer apparatus. As shown in fig. 7, the computer device comprises a memory, a processor, a communication interface and a communication bus, wherein a computer program that can be run on the processor is stored in the memory, and the steps of the method of the above embodiment are realized when the processor executes the computer program.
The processor may be a Central Processing Unit (CPU). The Processor may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, or a combination thereof.
The memory, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and units, such as the corresponding program units in the above-described method embodiments of the present invention. The processor executes various functional applications of the processor and the processing of the work data by executing the non-transitory software programs, instructions and modules stored in the memory, that is, the method in the above method embodiment is realized.
The memory may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created by the processor, and the like. Further, the memory may include high speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory optionally includes memory located remotely from the processor, and such remote memory may be coupled to the processor via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The one or more units are stored in the memory and when executed by the processor perform the method of the above embodiments.
The specific details of the computer device may be understood by referring to the corresponding related descriptions and effects in the above embodiments, and are not described herein again.
In order to achieve the above object, according to another aspect of the present application, there is also provided a computer-readable storage medium storing a computer program which, when executed in a computer processor, implements the steps in the above front-end interface data simulation method. It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a Flash Memory (Flash Memory), a Hard Disk (Hard Disk Drive, abbreviated as HDD) or a Solid State Drive (SSD), etc.; the storage medium may also comprise a combination of memories of the kind described above.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and they may alternatively be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, or fabricated separately as individual integrated circuit modules, or fabricated as a single integrated circuit module from multiple modules or steps. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (14)

1. A method for simulating data of a front-end interface, comprising:
receiving an interface request initiated by a front end;
and if the interface requested in the interface request is bound with a MockServer server, forwarding the interface request to the MockServer server so that the MockServer server returns the analog data corresponding to the interface requested in the interface request to the front end, wherein the MockServer server is deployed locally at the front end.
2. The front-end interface data simulation method of claim 1, further comprising, prior to the receiving a front-end initiated interface request:
and constructing the front end and simultaneously starting the MockServer server, wherein the MockServer server is bound with a target interface of the front end when being started, and loads analog data corresponding to the target interface from each function code file of the front end to local for caching.
3. The front-end interface data simulation method of claim 2, wherein the MockServer server monitors the simulation data corresponding to the target interface in each function code file of the front-end, empties the simulation data of the local cache when monitoring the data change, and loads the simulation data corresponding to the target interface from each function code file of the front-end to the local cache.
4. The front-end interface data simulation method according to claim 2, wherein the constructing the front-end and simultaneously starting the MockServer server specifically comprises:
and constructing the front end through a webpack tool and simultaneously starting the MockServer server through a hook function by utilizing the webpack-dev-server function of the webpack tool.
5. A front-end interface data simulation apparatus, comprising:
the interface request receiving module is used for receiving an interface request initiated by a front end;
and the interface request forwarding module is used for forwarding the interface request to the MockServer server if the interface requested in the interface request is bound with the MockServer server so as to enable the MockServer server to return the analog data corresponding to the interface requested in the interface request to the front end, wherein the MockServer server is deployed locally at the front end.
6. The front-end interface data simulation apparatus of claim 5, further comprising:
and the starting module is used for constructing the front end and simultaneously starting the MockServer server, wherein the MockServer server is bound with a target interface of the front end when being started, and loads the simulation data corresponding to the target interface from each function code file of the front end to be locally cached.
7. The front-end interface data simulation device according to claim 6, wherein the MockServer server monitors the simulation data corresponding to the target interface in each function code file of the front-end, empties the simulation data of the local cache when monitoring the data change, and loads the simulation data corresponding to the target interface from each function code file of the front-end to the local cache.
8. The front-end interface data simulation device of claim 6, wherein the start module is specifically configured to build the front end by a webpack tool and start the MockServer server by a hook function by using a webpack-dev-server function of the webpack tool.
9. A front-end interface data simulation system, comprising: the system comprises a webpack tool and a MockServer server, wherein the MockServer server is deployed at the front end locally;
the webpack tool is used for forwarding an interface request to the MockServer server when an interface requested in the interface request initiated by the front end is bound with the MockServer server;
and the MockServer server is used for returning the simulation data corresponding to the interface requested in the interface request to the front end.
10. The front-end interface data simulation system of claim 9,
the webpack tool is also used for constructing the front end and starting the MockServer server side at the same time;
the MockServer server is also used for binding with a target interface of the front end during starting, and loading simulation data corresponding to the target interface from each function code file of the front end to local cache.
11. The front-end interface data simulation system of claim 10,
the MockServer server is further configured to monitor the analog data corresponding to the target interface in each function code file of the front end, empty the analog data of the local cache when monitoring that the data changes, and load the analog data corresponding to the target interface from each function code file of the front end to the local cache.
12. The front-end interface data simulation system of claim 10,
the webpack tool is specifically used for building the front end and starting the MockServer server through a hook function by using a webpack-dev-server function.
13. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of any of claims 1 to 4 when executing the computer program.
14. A computer-readable storage medium, in which a computer program is stored which, when executed in a computer processor, implements the method of any one of claims 1 to 4.
CN202110429294.XA 2021-04-21 2021-04-21 Front-end interface data simulation method, device and system Active CN113050923B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110429294.XA CN113050923B (en) 2021-04-21 2021-04-21 Front-end interface data simulation method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110429294.XA CN113050923B (en) 2021-04-21 2021-04-21 Front-end interface data simulation method, device and system

Publications (2)

Publication Number Publication Date
CN113050923A true CN113050923A (en) 2021-06-29
CN113050923B CN113050923B (en) 2024-06-14

Family

ID=76520027

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110429294.XA Active CN113050923B (en) 2021-04-21 2021-04-21 Front-end interface data simulation method, device and system

Country Status (1)

Country Link
CN (1) CN113050923B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107329890A (en) * 2017-06-06 2017-11-07 北京金山安全软件有限公司 Test method and device based on Mock and server
CN109213487A (en) * 2018-08-22 2019-01-15 郑州云海信息技术有限公司 A kind of data capture method and its relevant device
CN109388425A (en) * 2018-08-17 2019-02-26 东莞数汇大数据有限公司 A kind of interface switching method, system, device and the storage medium of front end engineering
CN112015573A (en) * 2020-08-25 2020-12-01 云账户技术(天津)有限公司 Interface data simulation method and device and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107329890A (en) * 2017-06-06 2017-11-07 北京金山安全软件有限公司 Test method and device based on Mock and server
CN109388425A (en) * 2018-08-17 2019-02-26 东莞数汇大数据有限公司 A kind of interface switching method, system, device and the storage medium of front end engineering
CN109213487A (en) * 2018-08-22 2019-01-15 郑州云海信息技术有限公司 A kind of data capture method and its relevant device
CN112015573A (en) * 2020-08-25 2020-12-01 云账户技术(天津)有限公司 Interface data simulation method and device and electronic equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
秦子实;: "企业内网环境中基于Mock.js的前端应用独立调试方法", 电脑知识与技术, no. 17 *

Also Published As

Publication number Publication date
CN113050923B (en) 2024-06-14

Similar Documents

Publication Publication Date Title
CN110413288B (en) Application deployment method, device, server and storage medium
US8799889B2 (en) Application downloading
US20090119302A1 (en) Asynchronous client to server updates
CN104281468A (en) Method and system for distributed virtual machine image management
JP2012520504A (en) A programming model for synchronizing the browser cache across devices and web services
WO2011100171A2 (en) Tier splitting for occasionally connected distributed applications
US7562138B2 (en) Shared memory based monitoring for application servers
CN109033328A (en) A kind of access request processing method, device, equipment and readable storage medium storing program for executing
US11681585B2 (en) Data migration for a shared database
EP3860043A2 (en) Method and apparatus for implementing smart contract based on blockchain
KR20160141736A (en) Data view exposure mechanisms
CN112596762A (en) Rolling upgrading method and device
US20130007184A1 (en) Message oriented middleware with integrated rules engine
CN106919620B (en) Single page processing method and device
CN109939441B (en) Application multi-disk verification processing method and system
CN110267077B (en) Offline caching method, device, terminal and readable storage medium
CN108153794B (en) Page cache data refreshing method, device and system
JP2012128836A (en) Information processing apparatus, server, control method, program, and recording medium
US10997269B1 (en) Using web application components with different web application frameworks in a web application
CN110119388B (en) File reading and writing method, device, system, equipment and computer readable storage medium
CN112235132A (en) Method, device, medium and server for dynamically configuring service
CN113050923A (en) Front-end interface data simulation method, device and system
CN111078257B (en) H5 application package loading method and related device
US20120174078A1 (en) Smart cache for a server test environment in an application development tool
CN113779463A (en) Construction method, device and equipment of android terminal page and readable 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