CN111966347A - Method, device, equipment and storage medium for front-end driving back-end service - Google Patents
Method, device, equipment and storage medium for front-end driving back-end service Download PDFInfo
- Publication number
- CN111966347A CN111966347A CN202010635966.8A CN202010635966A CN111966347A CN 111966347 A CN111966347 A CN 111966347A CN 202010635966 A CN202010635966 A CN 202010635966A CN 111966347 A CN111966347 A CN 111966347A
- Authority
- CN
- China
- Prior art keywords
- template
- data
- target
- parameters
- identifier
- 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.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/35—Creation or generation of source code model driven
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/958—Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
- G06F16/986—Document structures and storage, e.g. HTML extensions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/38—Creation or generation of source code for implementing user interfaces
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Human Computer Interaction (AREA)
- Data Mining & Analysis (AREA)
- Stored Programmes (AREA)
Abstract
The application relates to a method, a device, a computer device and a storage medium for front-end driving back-end service. The method comprises the following steps: receiving a request sent by a front-end page, wherein the request carries a product identifier and a template identifier; analyzing the request to obtain a product identifier and a template identifier; acquiring a target template determined according to the product identification and the template identification, wherein the target template comprises template parameters defined by adopting a front-end language; determining target data through template parameters; and sending the target data to the front-end page. If the target template is detected in the process of executing the service through the back end, executing the logic in the target template, after executing the logic in the target template, continuously executing the logic of the back end, and returning data to the front end through the logic of the back end. The target template is compiled by adopting a front-end programming language, and front-end personnel can self-define the corresponding template according to business requirements, so that the communication cost caused by inconsistent front-end and back-end data is reduced, and the development efficiency is accelerated.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for front-end driving backend services, a computer device, and a storage medium.
Background
The existing webpage development mode is as follows: the front-end developer writes a webpage interface template, delivers the webpage to the back-end developer to fill data and output a page, in the process, the front-end developer plays a role of an interface generator, and the format of the defined data and the data processing logic are delivered to the back end. Because the front-end and back-end developers are developed independently, the front-end cannot obtain a data structure or data processing which accords with the service condition, and in order to solve the problem, the front-end and back-end developers need to communicate repeatedly to obtain the interface return which accords with the current service, so that the development efficiency is low.
Disclosure of Invention
In order to solve the technical problem, the present application provides a method, an apparatus, a computer device, and a storage medium for front-end driving backend services.
The application provides a method for driving a back-end service by a front end, which comprises the following steps:
receiving a request sent by a front-end page, wherein the request carries a product identifier and a template identifier;
analyzing the request to obtain a product identifier and a template identifier;
acquiring a target template determined according to the product identification and the template identification, wherein the target template comprises template parameters defined by adopting a front-end language;
determining target data through template parameters;
and sending the target data to the front-end page.
The application provides a device of front end drive rear end service includes:
the request receiving module is used for receiving a request sent by a front-end page, and the request carries a product identifier and a template identifier;
the analysis module is used for analyzing the request to obtain a product identifier and a template identifier;
the template acquisition module is used for acquiring a target template determined jointly according to the product identifier and the template identifier, and the target template comprises template parameters defined by adopting a front-end language;
the data determining module is used for determining target data through the template parameters;
and the data sending module is used for sending the target data to the front-end page.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
analyzing the request to obtain a product identifier and a template identifier;
acquiring a target template determined according to the product identification and the template identification, wherein the target template comprises template parameters defined by adopting a front-end language;
determining target data through template parameters;
and sending the target data to the front-end page.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
analyzing the request to obtain a product identifier and a template identifier;
acquiring a target template determined according to the product identification and the template identification, wherein the target template comprises template parameters defined by adopting a front-end language;
determining target data through template parameters;
and sending the target data to the front-end page.
The method, the device, the computer equipment and the storage medium for the front-end drive back-end service comprise the following steps: receiving a request sent by a front-end page, wherein the request carries a product identifier and a template identifier; analyzing the request to obtain a product identifier and a template identifier; acquiring a target template determined according to the product identification and the template identification, wherein the target template comprises template parameters defined by adopting a front-end language; determining target data through template parameters; and sending the target data to the front-end page. The corresponding target template is compiled through the front-end programming language, if the target template is detected in the back-end execution service process, the logic in the target template is executed, the back-end logic is continuously executed, the template is compiled through the front-end programming language, and front-end personnel can customize the corresponding template according to business requirements, so that communication cost caused by inconsistent front-end and back-end data is reduced, and development efficiency is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
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 described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
FIG. 1 is a flow diagram illustrating a method for front-end driven backend services in one embodiment;
FIG. 2 is a flow diagram illustrating a method for front-end driven backend services in one embodiment;
FIG. 3 is a block diagram of an apparatus for front-end driven back-end services in one embodiment;
FIG. 4 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all 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 application.
In one embodiment, as shown in FIG. 1, a method of front-end driven back-end services is provided. The method is applied to a processor, and referring to fig. 1, the method for the front-end driving back-end service specifically includes the following steps:
step S201, a request sent by the front end page is received.
In this embodiment, the request carries a product identifier and a template identifier.
Step S202, the request is analyzed to obtain a product identifier and a template identifier.
Step S203, a target template determined jointly according to the product identification and the template identification is obtained.
In this embodiment, the target template includes template parameters defined in a front-end language.
And step S204, determining target data through the template parameters.
Step S205, sending the target data to the front end page.
Specifically, the front end pages may include conventional HTML pages and applet pages, among others. A request refers to computer instructions sent by a front-end page to obtain data. The computer instructions carry product identifiers and template identifiers, wherein the product identifiers and the template identifiers can be customized according to requirements, such as being defined by one or more of numbers, characters, or symbols. The product identification is used for identifying a product, the template identification is used for identifying a template, the same template can be applied to a plurality of products, and one product can also correspond to a plurality of templates. The template is a data template, and template parameters in the template may define the format of the data, the processing logic of the data, and so on. The format of the data includes a return format of the data, an acquisition format of the data, and the like. The template parameters comprise parameter identifiers and/or template functions, wherein the template functions comprise data processing functions and calling functions, the data processing functions are used for directly processing data corresponding to the parameters in the template, the calling functions are used for calling functions defined by the back end, and the functions defined by the back end are used for carrying out data processing to obtain corresponding data processing results. The template function includes input parameters and output parameters, the input parameters refer to parameters of the input template function, and the output parameters refer to parameters obtained after the execution of the template function.
And determining a unique target template according to the product identifier and the template identifier, wherein one or more template identifiers are carried in the request, and when a plurality of template identifiers exist, determining a corresponding target template according to each template identifier. The target template is a data template defined by a front-end language. The front-end language refers to a programming language used by a front-end technician to write front-end logic, such as front-end programming languages JavaScript and jQuery. The JavaScript is an transliterated script language, is a dynamic type, weak type, prototype-based language, and is internally provided with a support type. Its interpreter is called JavaScript engine, which is a part of the browser and is widely used in the client's scripting language. Used on HTML (an application under the standard universal markup language) web pages to add dynamic functionality to the HTML web page. The programming languages used when the back-end executes the service may be GO, Python, Java, and so on. GO (GOlang) is a statically strongly typed, compiled language developed by GOogle's Robert Griesemer, Rob Pike, and Ken Thompson. The GO language syntax is similar to C, but functionally: memory security, GC (garbage collection), structural morphology and CSP-style concurrent computation.
In one embodiment, any processing that conforms to the grammatical logic of the front-end programming language can be implemented in a target template written in the front-end language. The front-end developer intervenes in the development of the template layer, acquires, processes and assembles data or calls a function of the rear end according to business requirements, and generates a corresponding target template.
In one embodiment, the target template is accessed by the backend, which injects data and functions into the target template during execution of the service, such that the target template calls the data or functions in the backend service. When the front end edits the target template, data processing logic is added into the target template, and data required by the front end is assembled in the target template according to the front end service requirement.
And generating a data acquisition request according to the product identifier of the product and the template identifier of the template, and after receiving the request, analyzing the request by the back end to obtain the product identifier and the template identifier. And acquiring data from the corresponding database through the parameter identification and/or the template function in the template parameter in the target template. And returning the target data to the front-end page, wherein the front-end page can directly display the data and can also display the data after processing. The target data may be data with an HTML tag or data in JSON format. Because the data in the JSON format cannot be directly displayed at the front end, when the data in the JSON format is returned, the data in the JSON format needs to be displayed after being processed according to the display requirement of the front end, that is, after the data in the JSON format is received by the front end, the data is analyzed, the house number is combined with the front end tag to obtain the data carrying the front end tag, and the data carrying the front end tag is rendered into a page to be displayed. The returned data with the HTML tags can be directly rendered into a page presentation.
In one embodiment, the target template may be stored in a file or data. Such as in a file schema, in a file repository. The adding or modifying process of the target template needs to modify the content in the file when the target template is stored in the file form, and directly modifies the data when the target template is stored in the data form. If the target template is stored in the gitlab in a file mode, and then through the hook function of the gitlab, when the code is added or modified, the change is synchronously stored in the mongo database (MongoDB). Wherein, gitlab is a code management tool, and MongoDB is a database based on distributed file storage, written in C + + language, and is intended to provide an extensible high-performance data storage solution for WEB applications. The storage in a data form means that an online target template editing page is developed, and a target template generated by the online target template editing page is directly stored in a database by data.
The method for the front-end driving back-end service comprises the following steps: receiving a request sent by a front-end page, wherein the request carries a product identifier and a template identifier; analyzing the request to obtain a product identifier and a template identifier; acquiring a target template determined according to the product identification and the template identification, wherein the target template comprises template parameters defined by adopting a front-end language; determining target data through template parameters; and sending the target data to the front-end page. The corresponding target template is compiled through the front-end programming language, if the target template is detected in the back-end execution service process, the logic in the target template is executed, the back-end logic is continuously executed, the template is compiled through the front-end programming language, and front-end personnel can self-define the corresponding template according to business requirements, so that the problem caused by inconsistent front-end and back-end data is reduced.
In one embodiment, step S204 includes: determining a data format according to the template parameters, wherein the data format comprises a first format and a second format; when the data format is a first data format, acquiring first data through the template parameters, and taking the first data as the target data; and when the data format is the second data format, acquiring second data through the template parameters, injecting the second data into the target template to obtain a first template, and taking the first template as the target data.
Specifically, the data format is used for defining the form of the returned data, and a front-end developer of the returned data format can customize the data format according to requirements, such as defining the data format to be a JSON format or a data format with HTML tags, and the like, wherein the first data format refers to the JSON format, and the second data format refers to the format of the data with HTML tags. And when the data format is the JSON format, directly acquiring corresponding data according to the template parameters, and directly returning the acquired data as target data. And when the data format is the data format with the HTML label, injecting the obtained data into the target template to obtain a first template, taking the first template as target data, and returning to the first template.
All front-end pages can support data in a JSON format, part of the front-end pages can support data in a format with HTML tags, and front-end developers can define the data format of data needing to be returned according to the type and/or business requirements of the front-end pages. Developers can define corresponding data formats according to requirements so that the returned data can meet the current business requirements.
In one embodiment, the template parameters include parameter identifiers, and determining the target data through the template parameters includes: and determining third data according to the parameter identification, and taking the third data as target data.
Specifically, the parameter identifier is an identifier for identifying a parameter, corresponding data is acquired according to the parameter identifier, and the acquired data is used as target data. In the actual application process, a scene of directly acquiring data exists, a parameter identifier of a parameter can be directly defined in a template in the scene, data corresponding to the parameter identifier is directly acquired from data obtained in a back-end execution service according to the parameter identifier to obtain third data, and the third data is used as target data and returned to the target data.
In one embodiment, the determining the target data by the template parameter includes: acquiring fourth data according to the input parameters; substituting the fourth data into the template function to obtain data corresponding to the output parameter; and taking the data corresponding to the output parameters as target data.
Specifically, the template function refers to a function that processes data. The input parameters and the output parameters of the template function may be one or more. And acquiring a parameter value corresponding to each input parameter, and executing the template function to obtain a parameter value corresponding to each output parameter. The parameter value corresponding to the output parameter is taken as fourth data (target data). The template function may be directly processing data acquired by the target template, or may be calling the acquired function. In an actual application scenario, data obtained by a back-end service is different from data required by a front-end, and the front-end needs to process data provided by the back-end in order to meet business requirements, that is, the data obtained by the back-end is processed through a template function, so that the processed data meets the business requirements of the front-end.
In one embodiment, the template parameters include parameter identifiers and template functions, and the data obtained by acquiring corresponding data by using the template parameters and executing the template functions are used as target data.
Specifically, in an actual application scenario, part of the data may directly call data obtained by back-end execution, and part of the data needs to be processed. When the template parameters are defined, the parameter identification and the template function are defined in the template, the required data are directly obtained from the back end through the parameter identification, and the data obtained from the back end or the back end function is called to be subjected to data processing according to the template function, so that the required data are obtained.
In one embodiment, step S302 includes: and determining a target database according to the product identification, and searching a template with the same identification as the template identification from the target database to obtain the target template.
Specifically, the target database refers to a database storing parameters of products corresponding to product identifications. And searching a corresponding database according to the product identification, and searching a template in the searched database according to the template identification to obtain a target template.
In an embodiment, the method for front-end driving back-end services further includes: obtaining context information; and determining target data according to the template parameters and the context information.
Specifically, the context information refers to data and/or functions obtained in the process of performing the service by the backend. And (3) injecting the context information into the target template, namely injecting data and/or functions in the context information into the target template. Acquiring corresponding data from the context information through the parameter identification in the target template, acquiring the parameter value and the like of the corresponding function and/or the input parameter corresponding to the template function from the context information according to the template function in the target template, executing the template function to obtain corresponding data, and taking the data acquired according to the parameter identification in the target template and/or the data acquired by executing the template function as target data.
In one embodiment, the target template includes a user name, an age, a height, a weight, and the like, and data corresponding to a parameter identifier of the user name, the height, the weight, and the like is obtained from data injected into the target template according to the parameter identifier. The age can be calculated by an age calculation function, that is, according to the input parameters (the birth date and the current time of the user), specific values of the birth date and the current time of the corresponding user are obtained from the data injected into the target template, and the age (the output parameter) is calculated according to the obtained specific values.
In one embodiment, generating the target template includes: receiving template parameters, wherein the template parameters are parameters corresponding to the product identification; and generating a target template according to the template parameters, wherein the target template has a unique template identifier.
Specifically, the front-end developer writes or selects template parameters, wherein the template parameters include parameter identifications and/or template functions. The template parameters are determined according to the business requirements of the products, and each product has a unique product identifier. And generating a corresponding target template according to the template parameters, wherein the target template has a unique template identifier.
In one embodiment, the target template defines the background (background), icon, title (title), item (items), etc. of the template.
In one embodiment, the JS template can be published using a visual JavaScript template publication platform. The template is issued independently, so that the template and the back-end service can be decoupled in the issuing stage, the template can be changed and issued at any time, and the method is free and flexible.
In one embodiment, for illustrative purposes, the target template is a JavaScript template (Js template), and the environment for the backend execution service is GO. Referring to fig. 2, the method for the front-end driving backend services includes:
step S301, GO service. The GO service refers to the execution of back-end logic through the GO language. A corresponding toolkit is used in the GO service to add JavaScript parsing and execution capabilities to the service, e.g., the toolkit is an otto-dependent toolkit. In the process of executing the function in the back-end service, if the JS template exists, the JavaScript is parsed and injected into the JS template, that is, step S302 is executed.
And step S302, a JS template. And executing JavaScript logic, analyzing the JavaScript during the GOlang running, and injecting the context of the GOlang running into a JavaScript environment, so that the data in the GO environment can be obtained in the context of the JavaScript, and a function in the GO environment is called. After the execution is finished, the logic go is continued, i.e. step S303 is executed.
Step S303, GO service. The execution GO service returns data to the front end.
And step S304, outputting the data.
Step S305, front end interface. And rendering the front-end page according to the output data.
In one embodiment, while the GO logic is executing, if the presence of a JavaScript template is not detected, the GO logic continues to execute.
In one embodiment, a front-end developer can perform logic development in a template by using a familiar JavaScript language, and/or module-type development, can develop and extract a common template or a common function according to business requirements, and the like. The common template may be used by a plurality of products, and may be modified during use to generate a template corresponding to a product. A common function refers to a function that can be used by multiple templates. If the URL request received by the backend is: getlnsurepage? The product code is TT01& template, and the back end deconstructs the URL to obtain the product code and template. And searching a corresponding template in a corresponding database according to the product code and the template name, and taking the matched template as a target template.
The method for the front-end driving back-end service separates data more thoroughly. The rear-end developer accesses the JavaScript template in the service, and injects data and functions in the service execution process into the template, so that the JavaScript in the template can smoothly call the data or functions in the rear-end service. The front-end developer can process logic on the data in the JavaScript template, and the data which is most needed by the front end is assembled in the JavaScript template according to the requirements of the front-end service, and the back-end developer only needs to pay attention to the flow of the basic data of the service without knowing the service, then performs data assembly according to the service, and provides the assembled data to the front end.
The existing front-end data driving framework moves the combination of data and a template to the front end, namely, the rendering of a page is changed through the change of the data. Joint debugging refers to joint debugging between the front end and the back end, which generally takes their own roles and cannot exceed the boundaries of the front end and the back end. The method executes joint debugging of the front end and the back end without intervention of a back end developer, and the back end developer only needs to provide basic service bearing a JavaScript template, so that the communication cost of the two parties is saved, and the development progress is accelerated.
And processing the data through a target template developed by the front end, namely partially decoupling the data layer from the back end logic. The integration capability of the data layer is exposed and provided for the front-end developer to use. And because the integration capability of the data layer is developed based on the front-end language, the front-end developer directly adopts the familiar language for development, the learning cost for learning the back-end language is reduced, and the development efficiency is improved.
FIG. 1 is a flow diagram illustrating a method for front-end driven backend services in one embodiment. It should be understood that, although the steps in the flowchart of fig. 1 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a portion of the steps in fig. 1 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 3, there is provided an apparatus 200 for front-end driven back-end services, comprising:
the request receiving module 201 is configured to receive a request sent by a front-end page, where the request carries a product identifier and a template identifier.
And the analysis module 202 is configured to analyze the request to obtain a product identifier and a template identifier.
And the template obtaining module 203 is configured to obtain a target template determined jointly according to the product identifier and the template identifier, where the target template includes template parameters defined by a front-end language.
And the data determining module 204 is configured to determine the target data according to the template parameters.
And a data sending module 205, configured to send the target data to the front-end page.
In one embodiment, the data determining module 204 is specifically configured to determine a data format according to the template parameter, where the data format includes a first format and a second format; and when the data format is the first data format, acquiring first data through the template parameters, and taking the first data as target data, and when the data format is the second data format, acquiring second data through the template parameters, injecting the second data into the target template to obtain the first template, and taking the first template as the target data.
In an embodiment, the data determining module 204 is specifically configured to determine third data according to the parameter identifier, use the third data as target data, and include the parameter identifier in the template parameter.
In an embodiment, the data determining module 204 is further specifically configured to substitute fourth data obtained according to the input parameter into a template function to obtain data corresponding to the output parameter, and use the data corresponding to the output parameter as target data, where the template parameter includes a template function, and the template function includes an input parameter and an output parameter.
In one embodiment, the template obtaining module 203 is specifically configured to determine the target database according to the product identifier; and searching a template with the same identifier as the template identifier from the target database to obtain the target template.
In one embodiment, the apparatus 200 for front-end driven back-end services further includes:
the context information acquisition module is used for acquiring context information;
the data determining module 204 is specifically configured to determine the target data according to the template parameters and the context information.
In one embodiment, the template generation module is configured to generate a target template.
In this embodiment, the template generating module is specifically configured to receive a template parameter, where the template parameter is a parameter corresponding to the product identifier; and generating a target template according to the template parameters, wherein the target template has a unique template identifier.
In one embodiment, the apparatus 200 for front-end driven back-end services further comprises:
and the template storage module is used for storing the target template in a file form or storing the target template in a data form.
FIG. 4 is a diagram illustrating an internal structure of a computer device in one embodiment. As shown in fig. 4, the computer apparatus includes a processor, a memory, a network interface, an input device, and a display screen connected via a system bus. Wherein the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program that, when executed by the processor, causes the processor to implement a method of front-end driven back-end services. The internal memory may also have a computer program stored therein, which when executed by the processor, causes the processor to perform a method for front-end driven back-end services. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 4 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, the apparatus 200 of the front-end driven back-end service provided by the present application may be implemented in a form of a computer program, and the computer program may be run on a computer device as shown in fig. 4. The memory of the computer device may store various program modules constituting the apparatus of the front-end drive back-end service, such as the request receiving module 201, the parsing module 202, the template obtaining module 203, the data determining module 204, and the data sending module 205 shown in fig. 3. The computer program constituted by the respective program modules causes the processor to execute the steps in the method of front-end driven back-end service of the respective embodiments of the present application described in the present specification.
For example, the computer device shown in fig. 4 may perform receiving, by the request receiving module 201 in the apparatus of the front-end driven back-end service shown in fig. 3, a request sent by a front-end page, where the request carries a product identifier and a template identifier. The computer device may perform parsing of the request by parsing module 202 to obtain the product identifier and the template identifier. The computer device may execute, via the template obtaining module 203, obtaining a target template determined jointly according to the product identifier and the template identifier, where the target template includes template parameters defined by a front-end language. The computer device may determine the target data from the template parameters via the data determination module 204. The computer device may perform sending the target data to the front-end page through the data sending module 205.
In one embodiment, a computer device is provided, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the steps of any of the embodiments of the method for front-end driven back-end services described above are implemented.
In one embodiment, a computer readable storage medium is provided, having stored thereon a computer program, which when executed by a processor, performs the steps of any of the embodiments of the method of front-end driven back-end services described above.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the steps of any embodiment of the method for front-end driven back-end services described above.
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 non-volatile computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the program is executed. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present invention, which enable those skilled in the art to understand or practice the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (11)
1. A method of front-end driven back-end services, the method comprising:
receiving a request sent by a front-end page, wherein the request carries a product identifier and a template identifier;
analyzing the request to obtain the product identification and the template identification;
acquiring a target template determined according to the product identifier and the template identifier, wherein the target template comprises template parameters defined by adopting a front-end language;
determining target data through the template parameters;
and sending the target data to the front-end page.
2. The method of claim 1, wherein said determining target data from said template parameters comprises:
determining a data format according to the template parameters, wherein the data format comprises a first format and a second format;
when the data format is the first data format, acquiring first data through the template parameters, and taking the first data as the target data;
and when the data format is a second data format, acquiring the second data through the template parameters, injecting the second data into the target template to obtain a first template, and taking the first template as the target data.
3. The method of claim 1, wherein the template parameters include parameter identifiers, and the determining the target data through the template parameters includes:
and determining third data according to the parameter identification, and taking the third data as the target data.
4. The method of claim 1, wherein the template parameters include a template function, the template function includes input parameters and output parameters, and the determining the target data through the template parameters includes:
acquiring fourth data according to the input parameters;
substituting the fourth data into the template function to obtain data corresponding to the output parameter;
and taking the data corresponding to the output parameters as the target data.
5. The method of claim 1, wherein obtaining the target template determined by the product identifier and the template identifier comprises:
determining a target database according to the product identification;
and searching a template with the same identifier as the template identifier from the target database to obtain the target template.
6. The method of claim 1, further comprising:
obtaining context information;
the determining the target data through the template parameters includes: and determining the target data according to the template parameters and the context information.
7. The method of claim 1, wherein the step of generating the target template comprises:
receiving the template parameters, wherein the template parameters are parameters corresponding to the product identification;
and generating the target template according to the template parameters, wherein the target template has a unique template identifier.
8. The method of claim 7, further comprising:
saving the target template in a file form; or
Storing the target template in data form.
9. An apparatus for front-end driven back-end services, the apparatus comprising:
the request receiving module is used for receiving a request sent by a front-end page, and the request carries a product identifier and a template identifier;
the analysis module is used for analyzing the request to obtain the product identifier and the template identifier;
the template acquisition module is used for acquiring a target template determined according to the product identifier and the template identifier, and the target template comprises template parameters defined by adopting a front-end language;
the data determining module is used for determining target data through the template parameters;
and the data sending module is used for sending the target data to the front-end page.
10. 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 steps of the method of any of claims 1 to 8 are implemented when the computer program is executed by the processor.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010635966.8A CN111966347A (en) | 2020-07-03 | 2020-07-03 | Method, device, equipment and storage medium for front-end driving back-end service |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010635966.8A CN111966347A (en) | 2020-07-03 | 2020-07-03 | Method, device, equipment and storage medium for front-end driving back-end service |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111966347A true CN111966347A (en) | 2020-11-20 |
Family
ID=73362180
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010635966.8A Pending CN111966347A (en) | 2020-07-03 | 2020-07-03 | Method, device, equipment and storage medium for front-end driving back-end service |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111966347A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113076095A (en) * | 2021-04-23 | 2021-07-06 | 南京始云网络科技有限公司 | Service implementation method and system based on separation of basic and logic functions |
-
2020
- 2020-07-03 CN CN202010635966.8A patent/CN111966347A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113076095A (en) * | 2021-04-23 | 2021-07-06 | 南京始云网络科技有限公司 | Service implementation method and system based on separation of basic and logic functions |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108932122B (en) | Interface document generation method, device, computer equipment and storage medium | |
CN109901834B (en) | Document page generation method, device, computer equipment and storage medium | |
CN108804159B (en) | Javascript module loading method and preprocessing method and device thereof, and computer equipment | |
CN109684607B (en) | JSON data analysis method and device, computer equipment and storage medium | |
CN109840083B (en) | Webpage component template construction method and device, computer equipment and storage medium | |
CN108595697B (en) | Webpage integration method, device and system | |
CN113419729B (en) | Front-end page building method, device, equipment and storage medium based on componentization | |
AU2019283802A1 (en) | Automatic discovery of locations of translated text in localized applications | |
CN112596714A (en) | Webpage development method, device, terminal, server and storage medium | |
CN113010827A (en) | Page rendering method and device, electronic equipment and storage medium | |
CN111290996A (en) | Document format conversion method, device, equipment and readable storage medium | |
CN111310005B (en) | Processing method and device of network request, server and storage medium | |
CN112835809A (en) | Test data setting method, device, equipment and medium based on browser | |
CN110162301B (en) | Form rendering method, form rendering device and storage medium | |
CN114218052B (en) | Service interaction diagram generation method, device, equipment and storage medium | |
CN115599386A (en) | Code generation method, device, equipment and storage medium | |
US20220284371A1 (en) | Method, device and medium for a business function page | |
CN111966347A (en) | Method, device, equipment and storage medium for front-end driving back-end service | |
CN112416533A (en) | Method and device for running application program on browser and electronic equipment | |
CN113296752A (en) | Method, system, device and storage medium for generating API document | |
CN109582580B (en) | System, method and apparatus for debugging pages | |
CN111881043A (en) | Page testing method and device, storage medium and processor | |
CN111273964A (en) | Data loading method and device | |
CN115390835A (en) | Method and device for constructing small program labeling search box | |
CN114546381A (en) | Front-end page code file generation method and device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |