CN110457144B - Method, device, medium and equipment for realizing front-end application - Google Patents

Method, device, medium and equipment for realizing front-end application Download PDF

Info

Publication number
CN110457144B
CN110457144B CN201910715754.8A CN201910715754A CN110457144B CN 110457144 B CN110457144 B CN 110457144B CN 201910715754 A CN201910715754 A CN 201910715754A CN 110457144 B CN110457144 B CN 110457144B
Authority
CN
China
Prior art keywords
calling
information
configuration
class library
interface
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
CN201910715754.8A
Other languages
Chinese (zh)
Other versions
CN110457144A (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.)
Douyin Vision Co Ltd
Douyin Vision Beijing Co Ltd
Original Assignee
Beijing ByteDance Network Technology 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 Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN201910715754.8A priority Critical patent/CN110457144B/en
Publication of CN110457144A publication Critical patent/CN110457144A/en
Application granted granted Critical
Publication of CN110457144B publication Critical patent/CN110457144B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services

Abstract

The disclosure provides a method, an apparatus, a medium and an electronic device for implementing front-end application. The method comprises the following steps: generating a calling class library according to the text file and the configuration file of the interface description language; the calling class library comprises a plurality of calling classes, and each calling class comprises a plurality of packaged calling functions; and calling the application program interface service of the back end based on the calling function and the configuration information of the configuration file. The method and the system automatically generate the calling class library through the text file and the configuration file of the interface description language, and reduce the workload of developers. The generated call class library sends HTTP request messages with wide application range by default. And the generated calling class library has small volume and meets the high requirement of the front end on the code volume. The method is suitable for scenes of Web, WebView and applets.

Description

Method, device, medium and equipment for realizing front-end application
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a medium, and an electronic device for implementing front-end application.
Background
The development of current application programs is more and more complex, and a multi-service architecture is generally adopted by a back end. Multiple services are often developed by different people and may also be developed using different programming languages. The multiple services at the back end are generally connected through an Application Programming Interface (API). Since there are different development languages, it makes it extremely complicated for multiple development languages to call the API.
The Remote Procedure Call (RPC) framework shields the bottom communication details, provides an open and transparent unified Remote communication API for various development languages, and effectively improves the development efficiency of the back-end API.
However, because the front end has a strict requirement on the code volume, the code volumes of the serialization library and the API library of the RPC framework are large, and the anti-serialization processing of the RPC framework basically cannot use the RPC framework in the development of the front end.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
An object of the present disclosure is to provide a method, an apparatus, a medium, and an electronic device for implementing a front-end application, which can solve at least one of the above-mentioned technical problems. The specific scheme is as follows:
according to a specific embodiment of the present disclosure, in a first aspect, the present disclosure provides a method for implementing a front-end application, including:
generating a calling class library according to the text file and the configuration file of the interface description language; the calling class library comprises a plurality of calling classes, and each calling class comprises a plurality of packaged calling functions;
and calling the application program interface service of the back end based on the calling function and the configuration information of the configuration file.
According to a second aspect, the present disclosure provides an apparatus for implementing a front-end application, including:
the generation calling class library unit is used for generating a calling class library according to the text file and the configuration file of the interface description language; the calling class library comprises a plurality of calling classes, and each calling class comprises a plurality of packaged calling functions;
and the calling unit is used for calling the application program interface service at the rear end based on the calling function and the configuration information of the configuration file.
According to a third aspect, the present disclosure provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of implementing a front-end application as defined in any one of the first aspects.
According to a fourth aspect thereof, the present disclosure provides an electronic device, comprising: one or more processors; storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement a method of implementing a front-end application as described in any of the first aspects.
Compared with the prior art, the scheme of the embodiment of the disclosure at least has the following beneficial effects:
the disclosure provides a method, an apparatus, a medium and an electronic device for implementing front-end application. The method comprises the following steps: generating a calling class library according to the text file and the configuration file of the interface description language; the calling class library comprises a plurality of calling classes, and each calling class comprises a plurality of packaged calling functions; and calling the application program interface service of the back end based on the calling function and the configuration information of the configuration file.
The method and the system automatically generate the calling class library through the text file and the configuration file of the interface description language, and reduce the workload of developers. The generated call class library sends HTTP request messages with wide application range by default. And the generated calling class library has small volume and meets the high requirement of the front end on the code volume. The method is suitable for scenes of Web, WebView, ReactNative and applets.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale. In the drawings:
FIG. 1 illustrates a flow chart of a method of implementing a front-end application in accordance with an embodiment of the present disclosure;
FIG. 2 illustrates a block diagram of elements of an apparatus implementing a front-end application, in accordance with an embodiment of the present disclosure;
fig. 3 shows an electronic device connection structure schematic according to an embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
Alternative embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
The first embodiment provided by the present disclosure, that is, an embodiment of a method for implementing a front-end application.
The embodiment of the present disclosure is described in detail below with reference to fig. 1, where fig. 1 is a flowchart of a method for implementing a front-end application provided by the embodiment of the present disclosure.
The disclosed embodiments apply to the front end.
The front end, i.e. the foreground part of the website, runs on browsers such as a personal computer end and a mobile end and displays the webpages browsed by users.
And step S101, generating a calling class library according to the text file and the configuration file of the interface description language.
An Interface Description Language (IDL) is a computer language used to describe the Interface of software components. IDLs describe interfaces in a neutral way so that objects running on different platforms and programs written in different languages can communicate with each other. For example, one component is written in C + +, the other component is written in Java, and data communication is performed between the two components through IDL.
IDLs are typically used to remotely invoke software. In this case, object components on different operating systems are typically called by the remote client terminal, and may be written in different computer languages. The IDL establishes a bridge for communication between two different operating systems.
The text file of the interface description language is a file which can be opened and edited by a text editor, so that the interface description language has the advantages of simplicity in development and strong readability.
For example, the thread IDL is an interface description language independent of the programming language, allowing developers to describe and define interfaces in a near-programming manner; the Thrift IDL has a simple structure and clear semantics; the type defined by the Thrift IDL is relatively close to the data type in the existing various programming languages, and the learning cost is lower; the Thrift IDL file can be directly used for generating a calling class library, so that the development efficiency is improved; however, the thread IDL is used to describe a Remote Procedure Call (RPC) interface, and cannot be directly used to describe an HTTP interface.
In the embodiment of the present disclosure, in combination with the above advantages of the IDL, information related to an Application Programming Interface (API for short) is written in a comment of the IDL, so as to expand the IDL. The developer can read the text file of the interface description language and directly obtain the specific meaning of the IDL data type in the request message.
An API is a predefined function or convention that refers to the joining of different components of a software system. The goal is to provide software developers the ability to access general purpose software or hardware without having to access the native code or understand the details of the internal working mechanisms. The API has functions of data input and data output.
The call class library includes a plurality of call classes, each call class including a plurality of encapsulated call functions. The parameters of the calling function comprise an entry parameter and an exit parameter. The input parameter is data transmitted into the calling function when being called; the output parameter is information returned after calling the application program interface service of the back end.
For example, a service in a text file of an interface description language corresponds to a class in a library of calling classes, and an application program interface in the service corresponds to a calling function within the class.
The calling function in the disclosed embodiment sends the request message using the "fetch API" format by default.
Meanwhile, the calling function in the embodiment of the present disclosure further includes a custom request sending interface, and the calling function may call the custom request sending interface to send the request message.
The custom request sending interface can generate a custom request sending interface in the calling function according to the configuration information in the configuration file.
The user-defined request sending interface comprises: an entry parameter is invoked.
The call entry parameter at least comprises a character string parameter of a uniform resource locator.
Optionally, the call entry parameter further includes a request type parameter and/or an arbitrary type parameter.
For example, the call entry parameter satisfies the format:
(url:string,init?:RequestInit,opts?:any),
wherein the content of the first and second substances,
the method comprises 3 parameters, wherein a first parameter url is a uniform resource locator, must be filled, and is of string type;
the second parameter init? Selecting and filling the request type parameter, wherein the type is RequestInit;
the third parameter ops? The parameters can be any type, and the filling is optional.
Since the format of the call entry parameter is basically consistent with the parameter format of the "fetch API", the call class library can be compatible with two functions conveniently. Thereby providing an effective solution for some special processing scenarios.
The configuration file comprises configuration information used for processing some special conditions when the calling class library is generated, such as information for generating a custom request sending interface, and filtering out preset fields. The method comprises the following steps: JSON files, YAML files, and/or JS files.
Optionally, the generating a calling class library according to the text file and the configuration file of the interface description language includes the following steps:
step S101-1, first interface description information and first annotation information which accord with interface extension definition rules are obtained from a text file of an interface description language.
A text file of an interface description language comprising: first interface description information and first annotation information.
For example, the first interface description information is a thread IDL, the first comment information is information related to an application program interface service of the calling backend, such as HTTP information, for calling the HTTP interface, and the first comment information is written in a comment of the IDL to extend the IDL.
The interface extension defines rules, defines first annotation information, and defines the relationship and description method of the first interface description information and the first annotation information.
For example: the interface extension defines a rule including an expression of extension information of the first annotation information:
fer.<key>=<'value'>;
wherein the content of the first and second substances,
fer, represent the initial characteristic mark of the expanded information of the first annotation information conforming to interface expansion definition rule;
either before or after the blank space;
< key >, indicating extension information;
< 'value' >, represents the value of the extension information.
Step S101-2, the relation between the first interface description information and the first annotation information is explained according to the interface extension definition rule, and a syntax logic tree is generated.
I.e. the extension information is interpreted by the parser according to said interface extension definition rules. For example, continuing the above example, the first annotation information is HTTP-related information that extends the thread IDL in such a way as to be written inside the annotation, and the relation between the thread IDL and the annotation information is interpreted by the parser at compile time; on one hand, the extension information is read by a developer and tells the developer the specific meaning of the corresponding Thrift type in the HTTP request; on the other hand, the extension information is used for the parser to interpret and determine the implementation manner of the corresponding Thrift type in the generated calling class library.
The syntax logic tree is an abstract representation of the syntax structure of the source code; it expresses the syntactic structure of the programming language in the form of tree, each node on the tree represents a structure in the source code; the grammar does not represent every detail that appears in the true grammar; for example, nesting brackets are implicit in the structure of the tree and are not present in the form of nodes; whereas a conditional jump statement like the if-condition-then may be represented using a node with two branches. For example, the Syntax logic Tree refers to an Abstract Syntax Tree (AST).
And S101-3, analyzing the configuration file according to a preset configuration rule to acquire configuration information and a configuration structure.
Since the configuration information is recorded in the configuration file according to the configuration structure, if the configuration information in the configuration file is to be identified, the configuration file needs to be parsed according to the preset configuration rule.
The configuration is a hierarchical structure.
And S101-4, generating the calling class library based on the syntax logic tree, the configuration information and the configuration structure.
Optionally, the configuration structure is a hierarchical structure corresponding to the syntax logic tree.
For example, the configuration is:
- - - -Global configuration flag
-global configuration content
- | -File configuration flag
I-File Path
- | -configuration flags within files
-configuring content within a file
- | -service configuration flag
- | -service name
- | -in-service configuration flag
-configuring content within a service
I-interface configuration flag
- | -interface name
I-interface configuration content
The configuration structure and the syntax logic tree may form a mapping relationship.
Optionally, the generating the call class library based on the syntax logic tree, the configuration information, and the configuration structure includes the following steps:
and S101-4-11, acquiring a first corresponding relation between the syntax logic tree and the configuration structure.
And S101-4-12, mapping the configuration information to the syntax logic tree according to the first corresponding relation, and generating the calling class library.
The calling class library comprises a JavaScript (JS) type calling class library and a TypeScript (TS) type calling class library, and is respectively suitable for JS project engineering and TS project engineering. (ii) a In the TS type calling class library, each container type, such as struct in the Thrift and message in the Protocol Buffers, generates a corresponding interface; in order to implement namespace in the text file of the interface description language, the calling class library of the TS class library type adopts the following format:
“import*as<ns>from<file>”;
wherein the content of the first and second substances,
< file > refers to a text file of the dependent interface description language;
< ns > indicates the namespace name of the file if it depends;
if the namesapce name includes a point number, the point number is translated to an underline and the corresponding type references places are translated accordingly.
And step S102, calling the application program interface service of the back end based on the calling function.
The back end, also called website background technology or dynamic website technology, is used for dynamically changing the content on the front end page and implementing some code logics. For example, user registration and login verification, shopping settlement, and the like. Common website back-end development languages include asp, asp. Meanwhile, the website background technology further comprises a database for storing background data.
The application program interface service of the back end is a service for receiving a predefined function which is called and automatically generates return information. E.g., the services of the HTTP interface of the backend.
The application program interface service based on the calling function calling back end comprises the following steps:
step S102-1, the configuration information based on the calling function and the configuration file obtains the request message.
The request message includes request header information and request body information.
When the calling function is operated, the calling function automatically generates a request message.
The request header information includes information of the communication protocol and information associated with the requester information. For example, the request header information of the request message of HTTP includes: protocol type, target domain name and port, source domain name and port, uniform resource identifier, receivable data type, compression mode, language, connection mode.
The request body information includes request content sent by the requester.
And calling the function to generate a corresponding request message according to the preset protocol type. For example, if the predetermined protocol type is the HTTP type, the request message is a message generated according to the HTTP protocol.
Data is transmitted in a network, and the larger the data volume, the slower the speed of processing the data. To reduce the amount of data transmitted, it is often necessary to serialize the body information in the message (i.e., request body information) before transmitting the message. Serialization is the process of converting character information into a byte stream.
In this embodiment of the present disclosure, optionally, the configuration information includes serialization processing information.
The configuration information obtaining request message based on the calling function and the configuration file comprises:
and step S102-1-1, acquiring the configuration information.
Step S102-1-2, judging whether the configuration information comprises serialization processing information corresponding to the calling function.
And S102-1-3, if yes, acquiring a request message based on the calling function and the configured information, wherein the request body information is subjected to serialization processing.
For example, if the configuration information indicates that an HTTP request message is generated, the request message is generated according to the HTTP, and indicates that no serialization processing is performed on the request body information; the invoked application program interface is an HTTP interface.
For example, if the configuration information indicates that a thread or Protocol Buffers request message is generated, the request message is generated according to the thread or Protocol Buffers, and indicates that the request body information is serialized; the called application program interface is an RPC interface.
And step S102-2, calling the application program interface service of the back end according to the request message.
Optionally, after the calling of the application program interface service of the back end according to the request message, the method further includes:
and step S102-3, acquiring and processing a request response message associated with the request message.
The request response message is response information returned by the back-end application program interface according to the request message. Generally, the request response message includes request response header information and request response body information.
The request header information includes information of the communication protocol and information associated with the request responder. For example, the request response header information of the request response message of HTTP includes: protocol type, response time, control buffer mode, byte stream identification, compression mode and connection mode.
The request response body information comprises response contents sent by the responder.
The method specifically comprises the following steps:
and step S102-3-1, acquiring a request response message returned by the application program interface.
And step S102-3-2, acquiring the configuration information.
When the request body information of the request message is serialized, the request response body information of the returned request response message is also deserialized.
And step S102-3-3, judging whether the configuration information comprises serialization processing information corresponding to the calling function.
And S102-3-4, if so, performing deserialization processing on the request response body information, and acquiring a parameter value according to a preset response body information rule and the request response body information.
Deserialization is the process of converting a byte stream into character information. So as to convert the byte stream difficult to recognize into character information recognizable by the user. I.e. textual information.
Since the request response body information includes various information including the value of the argument. In order to facilitate communication transmission, multiple information needs to be organized into request response body information through a preset response body information rule.
And decomposing the request response body information according to a preset response body information rule so as to obtain the value of the parameter.
The method and the device for automatically generating the calling class library automatically generate the calling class library through the text file and the configuration file of the interface description language, and reduce the workload of a developer. The generated call class library sends HTTP request messages with wide application range by default. And the generated calling class library has small volume and meets the high requirement of the front end on the code volume. The method is suitable for scenes of Web, WebView and applets.
Corresponding to the first embodiment provided by the present disclosure, the present disclosure also provides a second embodiment, that is, an apparatus for implementing front-end application. Since the second embodiment is basically similar to the first embodiment, the description is simple, and the relevant portions should be referred to the corresponding description of the first embodiment. The device embodiments described below are merely illustrative.
Fig. 2 illustrates an embodiment of an apparatus for implementing a front-end application provided by the present disclosure. Fig. 2 is a block diagram of a unit of an apparatus for implementing a front-end application according to an embodiment of the present disclosure.
Referring to fig. 2, the present disclosure provides an apparatus for implementing front-end application, including: the call class library unit 201 and the call unit 202 are generated.
A generation calling class library unit 201, configured to generate a calling class library according to the text file and the configuration file of the interface description language; the calling class library comprises a plurality of calling classes, and each calling class comprises a plurality of packaged calling functions;
a calling unit 202, configured to call a backend application program interface service based on the calling function and the configuration information of the configuration file.
Optionally, the generating call class library unit 201 includes:
the text information acquiring subunit is used for acquiring first interface description information and first annotation information which accord with interface extension definition rules from a text file of an interface description language;
a syntax logic tree generating subunit, configured to interpret a relationship between the first interface description information and the first annotation information according to the interface extension definition rule, and generate a syntax logic tree;
the configuration file analyzing subunit is used for analyzing the configuration file according to a preset configuration rule to acquire configuration information and a configuration structure;
and the generation calling class library subunit is used for generating the calling class library based on the syntax logic tree, the configuration information and the configuration structure.
Optionally, the generating a call class library subunit includes:
a first corresponding relation obtaining subunit, configured to obtain a first corresponding relation between the syntax logic tree and the configuration structure;
and the mapping subunit is used for mapping the configuration information into the syntax logic tree according to the first corresponding relation and generating the calling class library.
Optionally, the invoking unit 202 further includes:
an obtaining request message subunit, configured to obtain a request message based on the calling function and the configuration information of the configuration file; the request message comprises request header information and request body information;
and the request message calling subunit is used for calling the application program interface service at the rear end according to the request message.
Optionally, the configuration information includes serialization processing information corresponding to the call function;
in the get request message subunit, the method includes:
a first acquiring configuration information subunit, configured to acquire the configuration information;
the first judgment serialization subunit is used for judging whether the configuration information comprises serialization processing information corresponding to the call function;
and the serialization processing subunit is used for acquiring a request message based on the calling function and the configured information if the output result of the first judgment serialization identification subunit is 'yes', wherein the request body information is subjected to serialization processing.
Optionally, in the apparatus, the apparatus further includes:
and the response unit is used for acquiring and processing the request response message associated with the request message.
In the response unit, comprising:
a request response message acquiring subunit, configured to acquire a request response message returned by the application program interface; the request response message comprises request response head information and request response body information;
a second acquiring configuration information subunit, configured to acquire the configuration information;
a second determining serialization subunit, configured to determine whether the configuration information includes serialization processing information corresponding to the call function;
and the deserializing subunit is configured to perform deserializing on the request response body information if the output result of the second determining serialization identification subunit is yes, and obtain a parameter value according to a preset response body information rule and the request response body information.
Optionally, the calling function further includes a custom request sending interface; the user-defined request sending interface comprises a calling entry parameter;
the calling entry parameter at least comprises a character string parameter of a uniform resource locator;
and/or
The call entry parameter further comprises a request type parameter and/or an arbitrary type parameter.
The method and the device for automatically generating the calling class library automatically generate the calling class library through the text file and the configuration file of the interface description language, and reduce the workload of a developer. The generated call class library sends HTTP request messages with wide application range by default. And the generated calling class library has small volume and meets the high requirement of the front end on the code volume. The method is suitable for scenes of Web, WebView and applets.
The embodiment of the present disclosure provides a third embodiment, that is, an electronic device, where the electronic device is used to implement a method for front-end application, and the electronic device includes: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the one processor to cause the at least one processor to perform the method of implementing a front-end application as described in the first embodiment.
The fourth embodiment provides a computer storage medium for implementing a front-end application, where the computer storage medium stores computer-executable instructions that can execute the method for implementing the front-end application as described in the first embodiment.
Referring now to FIG. 3, shown is a schematic diagram of an electronic device suitable for use in implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 3 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 3, the electronic device may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 301 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)302 or a program loaded from a storage device 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data necessary for the operation of the electronic apparatus are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
Generally, the following devices may be connected to the I/O interface 305: input devices 306 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 307 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage devices 308 including, for example, magnetic tape, hard disk, etc.; and a communication device 309. The communication means 309 may allow the electronic device to communicate wirelessly or by wire with other devices to exchange data. While fig. 3 illustrates an electronic device having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 309, or installed from the storage means 308, or installed from the ROM 302. The computer program, when executed by the processing device 301, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring at least two internet protocol addresses; sending a node evaluation request comprising the at least two internet protocol addresses to node evaluation equipment, wherein the node evaluation equipment selects the internet protocol addresses from the at least two internet protocol addresses and returns the internet protocol addresses; receiving an internet protocol address returned by the node evaluation equipment; wherein the obtained internet protocol address indicates an edge node in the content distribution network.
Alternatively, the computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: receiving a node evaluation request comprising at least two internet protocol addresses; selecting an internet protocol address from the at least two internet protocol addresses; returning the selected internet protocol address; wherein the received internet protocol address indicates an edge node in the content distribution network.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of a unit does not in some cases constitute a limitation of the unit itself, for example, the first retrieving unit may also be described as a "unit for retrieving at least two internet protocol addresses".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (8)

1. A method for implementing a front-end application, comprising:
generating a calling class library according to the text file and the configuration file of the interface description language; the calling class library comprises a plurality of calling classes, and each calling class comprises a plurality of packaged calling functions;
calling an application program interface service at the back end based on the calling function and the configuration information of the configuration file;
the generating of the calling class library according to the text file and the configuration file of the interface description language comprises the following steps:
acquiring first interface description information and first annotation information which accord with interface extension definition rules from a text file of an interface description language;
interpreting the relation between the first interface description information and the first annotation information according to the interface extension definition rule to generate a syntax logic tree;
analyzing the configuration file according to a preset configuration rule to acquire configuration information and a configuration structure;
generating the calling class library based on the syntax logic tree, the configuration information and the configuration structure;
the generating the call class library based on the syntax logic tree, the configuration information, and the configuration structure includes:
acquiring a first corresponding relation between the syntax logic tree and the configuration structure;
and mapping the configuration information into the syntax logic tree according to the first corresponding relation, and generating the calling class library.
2. The method of claim 1, wherein the invoking an application programming interface service of a backend based on the calling function and the configuration information of the configuration file comprises:
acquiring a request message based on the calling function and the configuration information of the configuration file; the request message comprises request header information and request body information;
and calling the application program interface service of the back end according to the request message.
3. The method of claim 2, wherein the configuration information includes serialization processing information corresponding to the calling function;
the configuration information obtaining request message based on the calling function and the configuration file comprises:
acquiring the configuration information;
judging whether the configuration information comprises serialization processing information corresponding to the calling function;
and if so, acquiring a request message based on the calling function and the configured information, wherein the request body information is subjected to serialization processing.
4. The method of claim 2, further comprising, after said invoking an application programming interface service of a backend according to the request message:
acquiring a request response message returned by the application program interface; the request response message comprises request response head information and request response body information;
acquiring the configuration information;
judging whether the configuration information comprises serialization processing information corresponding to the calling function;
if so, performing deserialization processing on the request response body information, and acquiring a parameter value according to a preset response body information rule and the request response body information.
5. The method of claim 1, wherein the calling function further comprises a custom request-to-send interface; the user-defined request sending interface comprises a calling entry parameter;
the calling entry parameter at least comprises a character string parameter of a uniform resource locator;
and/or
The call entry parameter further comprises a request type parameter and/or an arbitrary type parameter.
6. An apparatus for implementing a front-end application, comprising:
the generation calling class library unit is used for generating a calling class library according to the text file and the configuration file of the interface description language; the calling class library comprises a plurality of calling classes, and each calling class comprises a plurality of packaged calling functions;
the calling unit is used for calling the application program interface service at the rear end based on the calling function and the configuration information of the configuration file;
wherein, in the generating call class library unit, the method comprises the following steps:
the text information acquiring subunit is used for acquiring first interface description information and first annotation information which accord with interface extension definition rules from a text file of an interface description language;
a syntax logic tree generating subunit, configured to interpret a relationship between the first interface description information and the first annotation information according to the interface extension definition rule, and generate a syntax logic tree;
the configuration file analyzing subunit is used for analyzing the configuration file according to a preset configuration rule to acquire configuration information and a configuration structure;
a generation call class library subunit, configured to generate the call class library based on the syntax logic tree, the configuration information, and the configuration structure;
in the generating call class library subunit, the method includes:
a first corresponding relation obtaining subunit, configured to obtain a first corresponding relation between the syntax logic tree and the configuration structure;
and the mapping subunit is used for mapping the configuration information into the syntax logic tree according to the first corresponding relation and generating the calling class library.
7. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the method according to any one of claims 1 to 5.
8. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to carry out the method of any one of claims 1 to 5.
CN201910715754.8A 2019-08-05 2019-08-05 Method, device, medium and equipment for realizing front-end application Active CN110457144B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910715754.8A CN110457144B (en) 2019-08-05 2019-08-05 Method, device, medium and equipment for realizing front-end application

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910715754.8A CN110457144B (en) 2019-08-05 2019-08-05 Method, device, medium and equipment for realizing front-end application

Publications (2)

Publication Number Publication Date
CN110457144A CN110457144A (en) 2019-11-15
CN110457144B true CN110457144B (en) 2021-12-07

Family

ID=68484732

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910715754.8A Active CN110457144B (en) 2019-08-05 2019-08-05 Method, device, medium and equipment for realizing front-end application

Country Status (1)

Country Link
CN (1) CN110457144B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111124541B (en) * 2019-12-25 2023-09-08 上海米哈游网络科技股份有限公司 Configuration file generation method, device, equipment and medium
CN111324342B (en) * 2020-02-10 2023-04-07 北京字节跳动网络技术有限公司 Method, device, medium and electronic equipment for generating interface layer code
CN111338813B (en) * 2020-02-10 2023-05-12 北京字节跳动网络技术有限公司 Method, device, medium and electronic equipment for dynamically generating middleware
CN111309375B (en) * 2020-02-11 2023-07-04 北京字节跳动网络技术有限公司 Method, device, medium and electronic equipment for generating remote procedure call toolkit
CN111309304B (en) * 2020-02-11 2023-07-11 北京字节跳动网络技术有限公司 Method, device, medium and electronic equipment for generating IDL file
CN111414161B (en) * 2020-03-27 2023-05-12 北京字节跳动网络技术有限公司 Method, device, medium and electronic equipment for generating IDL file
CN111767035A (en) * 2020-06-22 2020-10-13 星辰天合(北京)数据科技有限公司 Application interface docking method and device based on OpenAPI
CN114553966A (en) * 2022-01-21 2022-05-27 山东浪潮通软信息科技有限公司 Front-end Http request construction method, device, equipment and medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104009994A (en) * 2014-05-30 2014-08-27 北京京东尚科信息技术有限公司 Method and device for achieving communication of server side and client side
CN106648940A (en) * 2017-03-13 2017-05-10 北京百悟科技有限公司 Remote procedure call method and device
CN107301098A (en) * 2017-06-15 2017-10-27 搜易贷(北京)金融信息服务有限公司 A kind of remote procedure call device based on Thrift agreements, method and system
CN108038796A (en) * 2017-12-11 2018-05-15 厦门亿力吉奥信息科技有限公司 GIS service operation method, storage medium based on C++
CN109714332A (en) * 2018-12-26 2019-05-03 北京字节跳动网络技术有限公司 The method for converting protocol and device parsed based on Thrift and syntax tree
CN110069259A (en) * 2019-03-04 2019-07-30 北京三快在线科技有限公司 Analytic method, device, electronic equipment and storage medium based on idl file

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104009994A (en) * 2014-05-30 2014-08-27 北京京东尚科信息技术有限公司 Method and device for achieving communication of server side and client side
CN106648940A (en) * 2017-03-13 2017-05-10 北京百悟科技有限公司 Remote procedure call method and device
CN107301098A (en) * 2017-06-15 2017-10-27 搜易贷(北京)金融信息服务有限公司 A kind of remote procedure call device based on Thrift agreements, method and system
CN108038796A (en) * 2017-12-11 2018-05-15 厦门亿力吉奥信息科技有限公司 GIS service operation method, storage medium based on C++
CN109714332A (en) * 2018-12-26 2019-05-03 北京字节跳动网络技术有限公司 The method for converting protocol and device parsed based on Thrift and syntax tree
CN110069259A (en) * 2019-03-04 2019-07-30 北京三快在线科技有限公司 Analytic method, device, electronic equipment and storage medium based on idl file

Also Published As

Publication number Publication date
CN110457144A (en) 2019-11-15

Similar Documents

Publication Publication Date Title
CN110457144B (en) Method, device, medium and equipment for realizing front-end application
CN110489101B (en) Interface simulation method, system, medium and electronic equipment
CN110489323B (en) Visual RPC API debugging method, device, medium and equipment
US9122657B2 (en) Webpage display system leveraging OSGI
CN104683386B (en) The stake service implementing method and device of customizable response
US20070174420A1 (en) Caching of web service requests
CN111338623B (en) Method, device, medium and electronic equipment for developing user interface
CN109343975B (en) Method and apparatus for inter-page asynchronous communication
CN111813381A (en) Method, device, medium and electronic equipment for generating executable program in cross-platform mode
CN110377273B (en) Data processing method, device, medium and electronic equipment
CN111767229A (en) Performance test method, device and equipment
CN111600920B (en) JS-based data request proxy method, device, equipment and readable storage medium
US10944824B2 (en) Method and apparatus for processing media type in rest software architecture
CN111309304A (en) Method, device, medium and electronic equipment for generating IDL file
CN110851211A (en) Method, apparatus, electronic device, and medium for displaying application information
CN113761871A (en) Rich text rendering method and device, electronic equipment and storage medium
CN111857658A (en) Method, device, medium and electronic equipment for rendering dynamic component
CN110489326B (en) IDS-based HTTPAPI debugging method device, medium and equipment
CN116860286A (en) Page dynamic update method, device, electronic equipment and computer readable medium
CN115145574A (en) Code generation method and device, storage medium and server
CN109669720B (en) Chain type asynchronous request processing method and device based on Promise and electronic equipment
CN111539200A (en) Method, device, medium and electronic equipment for generating rich text
CN111831263B (en) Method, apparatus, electronic device and computer readable medium for data processing
CN112688863B (en) Gateway data processing method and device and electronic equipment
CN112445517B (en) Inlet file generation method, device, electronic equipment and computer readable 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
CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee after: Tiktok vision (Beijing) Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee before: BEIJING BYTEDANCE NETWORK TECHNOLOGY Co.,Ltd.

Address after: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee after: Douyin Vision Co.,Ltd.

Address before: 100041 B-0035, 2 floor, 3 building, 30 Shixing street, Shijingshan District, Beijing.

Patentee before: Tiktok vision (Beijing) Co.,Ltd.