API: Application Interface (api:application program Interface)
the function of using data interface
1. Encapsulation logic
The data interface queries data from the database and organizes it into JSON format, which, if written over each terminal, will write a lot of duplicate code
2, Easy distribution deployment
Multiple APIs can be deployed to facilitate the use of several terminals
3. Improve security
Avoids direct access to the database from the app side
Figure 1 The API is a bridge between the application cluster and the database
The API is also a middleware that provides data sharing for a variety of different platforms. Depending on the performance of data sharing between different software applications on a single or distributed platform, there are four types of APIs that can be grouped:
Remote Procedure Call (RPC): To implement communication between programs by acting on a shared data buffer (or task);
Standard Query Language (SQL): A standard query language for accessing data, which enables data sharing among applications through a common database;
File transfer: File transfer enables data sharing between applications by sending format files;
Information delivery: Refers to loosely coupled or tightly coupled application of small format information, through the direct communication between programs to achieve data sharing.
second, the project builds (code Http://pan.baidu.com/s/1i5nrT9V)
1. Technology selection: Using Springmvc+mybatis jdk1.7 TOMCAT7
(Note: There is no session, only the data interface, through the SPRINGMVC of controller to provide data services, using @responsebody annotation to convert data into a JSON array)
2. Project Build
-1 Pom.xml
-2 Web.xml
-3 Pring-servlet.xml
-4th Log configuration file
-5 Database Connection properties file
-6 MyBatis configuration file
3. Code writing (according to personal custom positive sequence, reverse writing) (using MyBatis)
-1 DAO Interface Class
-2 Mapping file
-3 entity Class code
-4 Service Interface Class
-5 Service Implementation Class
-6 Controller class
Another: APIs differ from graphical user interface (GUI) or command interface: API interfaces belong to an operating system or program interface, both of which belong to the direct user interface.
Hope to be helpful to you, wish you have a good mood, refuels.