Web API automatic deployment method and device

The method automates Web API deployment by extracting function codes, building Docker images, and running containers, addressing inefficiencies and security issues in conventional methods, resulting in efficient and secure interface generation.

CN119127230APending Publication Date: 2024-12-13ANHUI HUAYUNAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410860687.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

Conventional Web API creation processes are inefficient, prone to errors, and resource wasteful due to high complexity, low security, and poor compatibility, especially for APIs with simple functions and low coupling with development frameworks.

Method used

A method involving receiving user input code, extracting function codes, writing a Dockerfile, building an image, running a container, and generating an interface, with security measures and port mapping to ensure efficient and secure deployment, decoupled from the development framework.

Benefits of technology

The method simplifies and streamlines Web API deployment, enhancing security, compatibility, and resource efficiency while ensuring accurate and efficient interface generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127230A_ABST
    Figure CN119127230A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a Web API automatic deployment method and device. Application to the technical field of computers. The method comprises the steps of receiving data sent by a front-end form, extracting a function code from the data, compiling a Docker file according to the function code, constructing a mirror image according to the Docker file, running a container corresponding to the mirror image, and generating a corresponding interface. The method is simple to use, easy to implement, high in efficiency, good in compatibility and good in application prospect, and the function codes and the development framework are completely decoupled.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a Web API automatic deployment method and device. Background Art

[0002] Web API is an interface for communication between applications. The rules and protocols it defines allow developers to access data on remote servers and update or delete resources on remote servers through network requests, which can achieve sharing and various business needs. Web API is widely used in Web development, mobile application development, service integration and other fields.

[0003] Many Web APIs are completely independent of the development framework in terms of functions, such as some numerical calculations, data queries, etc. However, the conventional creation steps must still be followed when creating these Web APIs. This process is long, inefficient, and prone to errors. Therefore, using conventional Web API creation steps to create some Web APIs with relatively simple functions and low coupling with the development framework will cause a waste of resources; in addition, the conventional Web API creation steps have problems such as high complexity, low security, and poor compatibility. Therefore, it is extremely important to study the automatic generation method of Web APIs that are independent of the development framework. Summary of the invention

[0004] The present invention provides a Web API automatic deployment method, apparatus, device and storage medium.

[0005] According to a first aspect of the present disclosure, a Web API automatic deployment method is provided. The method comprises:

[0006] Receive data sent by the front-end form, and extract function codes from the data;

[0007] Write a Dockerfile according to the functional code and build an image according to the Dockerfile;

[0008] Run the container corresponding to the image and generate the corresponding interface.

[0009] In some implementations of the first aspect, running a container corresponding to the image further includes:

[0010] When the container corresponding to the image is run, the function code is executed and the execution result is returned to the front end so that the user can call the corresponding interface according to the execution result, and the port of the container is mapped to the corresponding port of the host, and the allocated port in the host is recorded through the port mapping record table.

[0011] In some implementations of the first aspect, executing the function code includes:

[0012] The function code is executed in conjunction with the Python interpreter in the container. If an error occurs when executing the function code, error information is obtained and sent to the user; wherein,

[0013] The Python interpreter is used to ensure that only trusted code is executed and to handle abnormal situations; wherein the abnormal situation includes at least one of the following: code execution timeout, memory overflow;

[0014] The error that occurs when executing the function code includes at least one of the following:

[0015] The function code is invalid or contains syntax errors or operation abnormalities.

[0016] In some implementations of the first aspect, mapping a port of the container to a corresponding port of the host includes:

[0017] The container port is mapped to a random port on the host, and the random port is recorded in a port mapping record table to avoid port conflicts;

[0018] Alternatively, you can allocate host ports through a configuration file and add containers to the host network according to the container's network mode so that the container can directly use the specified host port.

[0019] In some implementations of the first aspect, the front-end form includes a code input form; wherein,

[0020] The code input form is for receiving the code input by the user and / or the code file uploaded by the user at the front end.

[0021] In some implementations of the first aspect, after the front end receives the code input by the user and / or the code file uploaded by the user, the method includes:

[0022] On the front end, the syntax of the received code is highlighted through the code display interface, so that users can view, save, and share the code uploaded to the front end;

[0023] Record user operations through logs and track the execution of the code uploaded by users to the front end.

[0024] In some implementations of the first aspect, before writing a Dockerfile according to the function code, the process includes:

[0025] Taking security measures for the function code; wherein,

[0026] The safety measures include at least one of the following:

[0027] Code review, input validation, and restricted execution permissions.

[0028] According to a second aspect of the present disclosure, a Web API automatic deployment device is provided. The device includes:

[0029] A function code extraction module is used to receive data sent by a front-end form and extract function codes from the data;

[0030] An image building module, used to write a Dockerfile according to the functional code and build an image according to the Dockerfile;

[0031] The interface generation module is used to run the container corresponding to the image and generate the corresponding interface.

[0032] According to a third aspect of the present disclosure, an electronic device is provided. The electronic device includes: at least one processor; and a memory connected to the at least one processor in communication; the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the method described above.

[0033] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, where the computer instructions are used to cause a computer to execute the method as described above.

[0034] In the present disclosure, the backend receives the data sent by the frontend form, extracts the function code from the data, writes a Dockerfile according to the function code, builds an image according to the Dockerfile, runs the container corresponding to the image, and generates the corresponding interface. In this way, the problems of high complexity, low security, poor compatibility, and waste of resources in the existing Web API creation process are solved. The method is simple to use, easy to implement, has high efficiency and accuracy in interface deployment, and the function code is completely decoupled from the development framework, which has good application prospects.

[0035] It should be understood that the contents described in the summary of the invention are not intended to limit the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, among which:

[0037] Figure 1 A flowchart of a Web API automatic deployment method provided by an embodiment of the present disclosure is shown;

[0038] Figure 2 A logical schematic diagram of a Web API automatic deployment method provided by an embodiment of the present disclosure is shown;

[0039] Figure 3 A structural diagram of a Web API automatic deployment device provided by an embodiment of the present disclosure is shown;

[0040] Figure 4 A block diagram of an exemplary electronic device capable of implementing an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0042] In addition, the term "and / or" in this article is only a description of the association relationship between the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0043] In view of the problems arising in the background technology, the embodiments of the present disclosure provide a Web API automatic deployment method and device. Specifically, the backend receives the data sent by the front-end form, extracts the function code from the data, writes a Dockerfile according to the function code and builds an image according to the Dockerfile, runs the container corresponding to the image, and generates the corresponding interface. In this way, the problems of high complexity, low security, poor compatibility, and waste of resources in the existing Web API creation process are solved, and the method is simple to use, easy to implement, has high efficiency and accuracy in interface deployment, and the function code is completely decoupled from the development framework, and has good application prospects.

[0044] The Web API automatic deployment method and device provided by the embodiments of the present disclosure are described in detail below with reference to the accompanying drawings through specific embodiments.

[0045] Figure 1A flowchart of a Web API automatic deployment method provided by an embodiment of the present disclosure is shown. The method 100 includes the following steps:

[0046] S110, receiving data sent by the front-end form, and extracting a function code from the data.

[0047] In some embodiments, the front-end form includes a code input form; wherein,

[0048] The code input form is used to receive the code input by the user and / or the code file uploaded by the user at the front end;

[0049] Specifically, the user sends the input code and / or the uploaded code file to the front end, and the code input form in the front end receives the user input code and / or the uploaded code file.

[0050] In some embodiments, after the front end receives the code input by the user and / or the code file uploaded by the user, it includes:

[0051] On the front end, the syntax of the received code is highlighted through the code display interface, so that users can view, save, and share the code uploaded to the front end;

[0052] By recording user operations through logs, the execution of the code uploaded by users to the front end can be tracked, which is helpful for troubleshooting and security auditing.

[0053] In some embodiments, the extracted function code is automatically published to an existing Flask or Django framework so that subsequent operations can be performed on the function code in the existing Flask or Django framework.

[0054] S120, compile a Dockerfile according to the function code and build an image according to the Dockerfile.

[0055] In some embodiments, before writing the Dockerfile according to the function code, the process includes:

[0056] Taking security measures on the functional code to prevent the execution and abuse of malicious code; wherein,

[0057] The safety measures include at least one of the following:

[0058] Code review, input validation, and restricted execution permissions.

[0059] In some embodiments, you can use the docker build command, such as docker build -t<image_name><path_to_dockerfile> command, write a Dockerfile according to the function code and build an image according to the Dockerfile;

[0060] Then choose the appropriate publishing method according to your needs. For example, if you run a Docker container on your own server, you can directly use the docker run command to pull and run the published image.

[0061] If you configure a Docker orchestration tool, such as Kubernetes, you can manage and deploy containers based on cluster commands.

[0062] S130, running the container corresponding to the image, and generating a corresponding interface.

[0063] In some embodiments, the container corresponding to the image provides a suitable code execution environment for the functional code. The container has strong isolation, including a Python interpreter with restricted permissions and resource restrictions. The Python interpreter only executes trusted code and handles exceptions.

[0064] In some embodiments, running the container corresponding to the image further includes:

[0065] When the container corresponding to the image is run, the function code is executed, and the execution result is returned to the front end so that the user can call the corresponding interface according to the execution result, and the port of the container is mapped to the corresponding port of the host, and the allocated port in the host is recorded in the port mapping record table; wherein,

[0066] The execution results can be returned to the front end as text or JSON format data and displayed to the user on the web page.

[0067] In some embodiments, executing the function code includes:

[0068] The function code is executed in conjunction with the Python interpreter in the container. If an error occurs when executing the function code, error information is obtained and sent to the user; wherein,

[0069] The Python interpreter is used to ensure that only trusted code is executed and to handle abnormal situations; wherein the abnormal situation includes at least one of the following: code execution timeout, memory overflow;

[0070] The error that occurs when executing the function code includes at least one of the following:

[0071] The function code is invalid or contains syntax errors or operation abnormalities.

[0072] In some embodiments, mapping a port of the container to a corresponding port of the host includes:

[0073] When the container is run with the -P / -publish-all parameter, the container's port is mapped to a random port on the host, and the random port is recorded in the port mapping record table to avoid port conflicts. Furthermore, the dockerport command can be used to view the container's port mapping status.

[0074] For the specified host port, the host port is allocated through the configuration file, and the container is added to the host network according to the container's network mode, so that the port inside the container can be directly accessed. In this way, the container can directly use the specified host port without mapping;

[0075] The above port allocation methods are selected according to actual needs. No matter which method is used, it is necessary to ensure that the selected port is not occupied by other processes on the host and follow the correct port range to ensure the correct mapping of the port to the interface; in addition, when the port is no longer in use, the port information that is no longer in use needs to be deleted from the port mapping record table.

[0076] In some embodiments, the above steps can be used to successfully publish a Docker container and make it available for external use. Before publishing the container to a public environment, the security, stability, and applicability of the container and related software must be properly tested and reviewed.

[0077] Figure 2 A logical diagram of a Web API automatic deployment method provided by an embodiment of the present disclosure, such as Figure 2 As shown, the user side sends the input code or uploaded code file to the front end, and the front end sends these codes or code files to the back end so that the back end can extract function codes, build images, publish containers, generate interfaces, and perform port allocation and other operations. Finally, the back end returns the execution result (such as interface address) of the operation to the front end, and the user makes an interface call based on the returned execution result.

[0078] According to the embodiment of the present disclosure, the backend receives the data sent by the frontend form, extracts the function code from the data, writes a Dockerfile according to the function code and builds an image according to the Dockerfile, runs the container corresponding to the image, and generates the corresponding interface. In this way, the problems of high complexity, low security, poor compatibility, and waste of resources in the existing Web API creation process are solved, and the method is simple to use, easy to implement, has high efficiency and accuracy in interface deployment, and the function code is completely decoupled from the development framework, and has good application prospects.

[0079] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present disclosure is not limited by the order of the actions described, because according to the present disclosure, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present disclosure.

[0080] The above is an introduction to the method embodiment. The following is a further explanation of the scheme disclosed in the present invention through an apparatus embodiment.

[0081] Figure 3 The structure diagram of a Web API automatic deployment device provided by an embodiment of the present disclosure is shown. The device 200 includes:

[0082] The function code extraction module 210 is used to receive data sent by the front-end form and extract the function code from the data.

[0083] In some embodiments, module 210 is specifically configured to:

[0084] The front-end form includes a code input form;

[0085] The code input form is for receiving the code input by the user and / or the code file uploaded by the user at the front end.

[0086] In some embodiments, module 210 is further configured to:

[0087] After the front end receives the code input by the user and / or the code file uploaded by the user, it includes:

[0088] On the front end, the syntax of the received code is highlighted through the code display interface, so that users can view, save, and share the code uploaded to the front end;

[0089] Record user operations through logs and track the execution of the code uploaded by users to the front end.

[0090] The image building module 220 is used to write a Dockerfile according to the function code and build an image according to the Dockerfile.

[0091] In some embodiments, module 220 is specifically configured to:

[0092] Before writing the Dockerfile according to the function code, the following steps are included:

[0093] Taking security measures for the function code; wherein,

[0094] The safety measures include at least one of the following:

[0095] Code review, input validation, and restricted execution permissions.

[0096] The interface generation module 230 is used to run the container corresponding to the image and generate the corresponding interface.

[0097] In some embodiments, module 230 is specifically configured to:

[0098] Running the container corresponding to the image also includes:

[0099] When the container corresponding to the image is run, the function code is executed and the execution result is returned to the front end so that the user can call the corresponding interface according to the execution result, and the port of the container is mapped to the corresponding port of the host, and the allocated port in the host is recorded through the port mapping record table.

[0100] In some embodiments, module 230 is further configured to:

[0101] Executing the function code includes:

[0102] The function code is executed in conjunction with the Python interpreter in the container. If an error occurs when executing the function code, error information is obtained and sent to the user; wherein,

[0103] The Python interpreter is used to ensure that only trusted code is executed and to handle abnormal situations; wherein the abnormal situation includes at least one of the following: code execution timeout, memory overflow;

[0104] The error that occurs when executing the function code includes at least one of the following:

[0105] The function code is invalid or contains syntax errors or operation abnormalities.

[0106] In some embodiments, module 230 is further configured to:

[0107] Map the container's ports to the corresponding ports on the host, including:

[0108] The container port is mapped to a random port on the host, and the random port is recorded in a port mapping record table to avoid port conflicts;

[0109] Alternatively, you can allocate host ports through a configuration file and add containers to the host network according to the container's network mode so that the container can directly use the specified host port.

[0110] Understandably, Figure 3Each module / unit in the detection device 200 shown has the function of implementing each step in the detection method 100 provided in the embodiment of the present disclosure and can achieve its corresponding technical effect. For the sake of brevity, it will not be repeated here.

[0111] Figure 4 A block diagram of an exemplary electronic device capable of implementing an embodiment of the present disclosure is shown. Electronic device 400 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic device 400 may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0112] like Figure 4 As shown, the electronic device 400 includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 402 or a computer program loaded from a storage unit 408 into a random access memory (RAM) 403. In RAM 403, various programs and data required for the operation of the electronic device 400 can also be stored. The computing unit 401, ROM 402, and RAM 403 are connected to each other via a bus 404. An I / O interface 405 is also connected to the bus 404.

[0113] Multiple components in the electronic device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the electronic device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0114] The computing unit 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 401 performs the various methods and processes described above, such as method 100. For example, in some embodiments, the method 100 may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 400 via ROM 402 and / or communication unit 409. When the computer program is loaded into RAM 403 and executed by the computing unit 401, one or more steps of the method 100 described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to perform the method 100 in any other appropriate manner (e.g., by means of firmware).

[0115] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0116] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0117] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A 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, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0118] It should be noted that the present disclosure also provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute method 100 and achieve the corresponding technical effect achieved by executing the method in the embodiment of the present disclosure. For the sake of concise description, they are not repeated here.

[0119] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0120] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0121] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0122] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0123] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A Web API automated deployment method, characterized in that: include: Receive data sent by the front-end form, and extract function codes from the data; Write a Dockerfile according to the functional code and build an image according to the Dockerfile; Run the container corresponding to the image and generate the corresponding interface.

2. The method according to claim 1, characterized in that The running of the container corresponding to the image also includes: When the container corresponding to the image is run, the function code is executed and the execution result is returned to the front end so that the user can call the corresponding interface according to the execution result, and the port of the container is mapped to the corresponding port of the host, and the allocated port in the host is recorded through the port mapping record table.

3. The method according to claim 2, characterized in that The executing the function code comprises: The function code is executed in conjunction with the Python interpreter in the container. If an error occurs when executing the function code, error information is obtained and sent to the user; wherein, The Python interpreter is used to ensure that only trusted code is executed and to handle abnormal situations; wherein the abnormal situation includes at least one of the following: code execution timeout, memory overflow; The error that occurs when executing the function code includes at least one of the following: The function code is invalid or contains syntax errors or operation abnormalities.

4. The method according to claim 2, characterized in that: Mapping the port of the container to the corresponding port of the host includes: The container port is mapped to a random port on the host, and the random port is recorded in a port mapping record table to avoid port conflicts; Alternatively, you can allocate host ports through a configuration file and add containers to the host network according to the container's network mode so that the container can directly use the specified host port.

5. The method according to claim 1, characterized in that: The front-end form includes a code input form; wherein, The code input form is for receiving the code input by the user and / or the code file uploaded by the user at the front end.

6. The method according to claim 5, characterized in that After the front end receives the code input by the user and / or the code file uploaded by the user, it includes: On the front end, the syntax of the received code is highlighted through the code display interface, so that users can view, save, and share the code uploaded to the front end; Record user operations through logs and track the execution of the code uploaded by users to the front end.

7. The method according to claim 1, characterized in that Before writing the Dockerfile according to the function code, the following steps are included: Taking security measures for the function code; wherein, The safety measures include at least one of the following: Code review, input validation, and restricted execution permissions.

8. A Web API automatic deployment device, characterized in that: include: A function code extraction module is used to receive data sent by a front-end form and extract function codes from the data; An image building module, used to write a Dockerfile according to the functional code and build an image according to the Dockerfile; The interface generation module is used to run the container corresponding to the image and generate the corresponding interface.

9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-7.