what is the api interface and api document, and is there what we usually call api, is the interface? I have a small front end
what is the api interface and api document, and is there what we usually call api, is the interface? I have a small front end
API is Application Programming Interface. If you do the front end, then you will definitely feel sick. This definition is generally defined and written by the back end. Of course, it should be said that depending on the situation, you can also tell the back end that you are responsible for the interface document when you decide on the project. Of course, this situation is relatively rare. When it comes to interface documents, it is actually a URL in node, that is, something that req.query () or req.url gets. It is suggested that you download a postman special test interface and transfer documents for you to deal with interface data.
too professional terms are easy to understand, so let's move from simplicity to depth.
most applications start from scratch and roughly go through the following stages:
Product-Development-Test-launch-Operation and maintenance
most applications are data-centric, and all functions ultimately boil down to adding, deleting, modifying and querying data
Why is there a front end and a back end?
in today's Internet environment, especially Internet application
production must be achieved: fast and stable response to product demand, fast and stable iterative application version. The ultimate goal is to quickly seize the market and complete the strategic layout in order to achieve the business goal
performance must be achieved: fast and stable response to user requests, fast and stable presentation of user expectations. The ultimate goal is to solve users' pain points and cultivate users' habits so as to retain users continuously
the core of the above two sentences lies in "fast" and "stable"
Fast: development and writing fast, online speed fast, program running fast
stable: online iteration stable, program running stable, user experience stable
based on the above speed and stability, compared with the traditional software development process (one has to complete logical programming, page interaction, database and other work at the same time, the efficiency is not high and the degree of concentration and professionalism is not too high) it is necessary to adjust the working methods / methods / processes of various departments, types of work and positions, so there is agile development, which involves not only these, but also a lot.
in terms of development, database, business logic programming and page effect interaction are responsible. Professional people do professional things. As a result, the development mode of the separation of front and rear ends is gradually clear and standardized, which can improve the efficiency and level of technology, process and management to the greatest extent.
understands the separation of front and rear ends, and then API.
topic: what is API? What is an API document?
the front and back end separation is to separate the business logic from the page presentation. The back end is the business logic, and the front end is the page presentation. It must be integrated to be a complete application. How do you get together?
the backend student is responsible for writing the API interface according to the function point / business logic of the application, and the API interface is the final implementation of a certain function point / business logic in the backend.
if you've ever called an interface, you won't say any more. You must know what an interface looks like. Yes, that's what an interface looks like.
back-end students write N multiple interfaces to provide front-end calls. What function points / business logic do these interfaces correspond to? What parameters are required for each interface? What does each parameter mean? Which parameters are required? Which parameters can be left unfilled? What results can each interface return? What is the data type that returns the result? What should be returned under the correct circumstances? What should be returned in case of error? .
these questions in the development process, if the back-end students do not say a word, do not say a word, the front-end students will collapse, who am I? Where am I? God knows what these are.
that's why there is an API document. The API document is used to answer the above questions. It is a standard and clear interface specification, which describes in detail the function, input parameter, output parameter, return value of each interface. This interface document serves as a bridge for connecting and working with each other in the front and back end development, that is, it is not only the specification and constraint for the development work of the front and back end students, but also the specification and constraint for the function / business logic of the application. Minimize human errors and code errors.
The length ofis a little longer and the number of words is a little more. I wonder if the above answer can solve your doubts.
the general API refers to the API interface, but the documentation should be the most basic supporting.
< H2 > API < / H2 >API), (: application programming interface, abbreviation in English) also known as API, is a convention for the convergence of different components of a software system. Due to the increasing scale of software in recent years, it is often necessary to divide complex systems into small components, and the design of programming interfaces is very important. In the practice of programming, the design of programming interface should first divide the responsibilities of the software system reasonably. A good interface design can reduce the interdependence of various parts of the system, improve the cohesion of the constituent units, and reduce the coupling degree between the constituent units, so as to improve the maintainability and expansibility of the system.
I understand that api refers to the use of a function
for example, if the api returned from the backend is used to obtain the user list, then the api document describes how to use this API to return the user list correctly
or, for example, the http module of nodejs's api document, which describes how to use this http module to perform the request operation correctly.
Web usually initiates a request to the interface from the front end, and the backend executes the corresponding operation.
usually the front end initiates the get request, and the back end returns the corresponding data
the front end initiates the post request, and the back end processes the data sent from the front end
, while the API document explains how to use API,.
take the API of as an example
https://v1.hitokoto.cn/
when a get request is sent to this api, the one-word server will randomly return a sentence in the format of json
{
"id": 657,
"hitokoto": "",
"type": "a",
"from": "",
"creator": "",
"created_at": "1475388232"
}
the front end can use the returned data
the API mentioned in the front-end category refers to the interface provided by the back-end.
has the following elements:
only the API documents that meet the above requirements can standardize the front and back end work. The front end does not need to ask the back end questions, but can be developed directly according to the document
.