当前位置: 首页 > news >正文

做爰网站下载账号权重查询入口

做爰网站下载,账号权重查询入口,网站域名的注册时间,flash as3 网站模板简述 APIJSON是一个关于API和JSON的综合技术或框架,一种专为API设计的JSON网络传输协议,以及基于这套协议实现的ORM库。 1. 定义与特点: APIJSON是一种基于接口的JSON传输结构协议,它允许客户端定义任何JSON结构来向服务端发起…

简述

APIJSON是一个关于API和JSON的综合技术或框架,一种专为API设计的JSON网络传输协议,以及基于这套协议实现的ORM库。

1. 定义与特点:

  • APIJSON是一种基于接口的JSON传输结构协议,它允许客户端定义任何JSON结构来向服务端发起请求,服务端则返回对应结构的JSON字符串,实现“所求即所得”的效果。
  • 它为简单的增删改查提供了完全自动化的万能API,能够零代码实时满足各种新增和变更需求。
  • 通过APIJSON,可以大幅降低开发和沟通成本,简化开发流程,缩短开发周期。

2. 主要作用:

  • APIJSON的主要作用在于简化客户端和服务端之间的数据交换过程,使得前后端开发者能够更加高效地协同工作。
  • 它支持多种编程语言和平台,包括JavaScript、Python、Java、C#等,因此具有广泛的应用价值。

3. 使用场景:

  • APIJSON特别适用于中小公司、团队及个人开发者,解决他们在客户端和服务端之间数据交换的问题。
  • 它被广泛应用于Web开发、移动应用开发、桌面应用开发等领域。

4. 基本用法:

  • 定义API接口:使用类似JSON的格式来定义API接口,包括URL、请求方法、参数、返回结果等信息。
  • 发送请求:使用HTTP客户端工具(如Postman)或编程语言中的HTTP请求库来发送请求。
  • 解析返回结果:APIJSON服务端会返回符合定义的JSON格式的数据作为响应,开发者可以解析和处理返回的数据。

5. 优势:

  • 结构清晰:APIJSON的层次结构简洁清晰,易于人阅读和编写,同时也易于机器解析和生成。
  • 高效性:相比XML,JSON更小、更快,更易解析,因此其被广泛应用于网络数据传输领域。
  • 通用性:支持多种编程语言和平台,使得APIJSON成为一种通用的数据交换格式。

APIJSON CRUD

1. 创建(Create)

  • **功能:**通过APIJSON,你可以轻松地向数据库中添加新的记录。
  • 实现:
    1. 定义API接口,指定请求方法(如POST)、URL和请求体(JSON格式)。
    2. 在请求体中,包含要创建的数据的字段和值。
    3. 发送请求,APIJSON后端服务将解析请求体,并将数据插入到数据库中。
  • **示例:**假设有一个名为users的表,并希望添加一个新用户。可以发送一个POST请求到/api/users,请求体如下:
{  "user": {  "id": 0,  // 通常为自增主键,可省略或设为0  "name": "John Doe",  "age": 30,  "email": "johndoe@example.com"  }  
}

2. 读取(Read)

  • **功能:**通过APIJSON,你可以从数据库中检索数据。
  • 实现:
    1. 定义API接口,指定请求方法(如GET)、URL和查询参数(可选)。
    2. 发送请求,APIJSON后端服务将根据查询参数从数据库中检索数据。
  • **示例:**要检索所有用户,你可以发送一个GET请求到/api/users。要检索特定用户(如ID为1的用户),你可以发送GET请求到/api/users/1。
GET /User/1

返回结果:

{  "code": 200,  "msg": "success",  "data": {  "User": {  "id": 1,  "name": "John Doe",  "age": 30  }  }  
}

3. 更新(Update)

  • **功能:**通过APIJSON,你可以修改数据库中的现有记录。
  • 实现:
    1. 定义API接口,指定请求方法(如PUT或PATCH)、URL和请求体(JSON格式)。
    2. 在请求体中,包含要更新的数据的字段和新的值,以及用于标识要更新的记录的ID或其他唯一标识符。
    3. 发送请求,APIJSON后端服务将解析请求体,并更新数据库中的记录。
      -**示例:**要更新ID为1的用户的邮箱地址,你可以发送一个PUT或PATCH请求到/api/users/1,请求体如下:
{  "user": {  "id": 1,  "email": "newemail@example.com"  }  
}

4. 删除(Delete)

  • 功能: 通过APIJSON,你可以从数据库中删除现有记录。
  • 实现:
    1. 定义API接口,指定请求方法(如DELETE)、URL和查询参数(可选)。
    2. 发送请求,APIJSON后端服务将根据URL或查询参数从数据库中删除记录。
  • 示例: 要删除ID为1的用户,你可以发送一个DELETE请求到/api/users/1。
DELETE /User/1

DEMO

流程

  • **项目设置:**首先,确保你的项目中已经引入了APIJSON的依赖。对于Java项目,你需要在pom.xml文件中添加APIJSON的依赖(参考文章1)。
  • **数据库配置:**按照APIJSON的要求,配置数据库连接信息(如URL、用户名、密码等)。在Demo中,这些信息通常位于配置文件中,如DemoSQLConfig.java(参考文章2)。
  • **数据表:**假设我们有一个名为users的数据表,包含id、name、age等字段。

pom.xml

	<!-- 需要的 APIJSON 相关依赖 --><dependency><groupId>com.github.Tencent</groupId><artifactId>APIJSON</artifactId><version>6.3.0</version></dependency><dependency><groupId>com.github.APIJSON</groupId><artifactId>apijson-framework</artifactId><version>6.3.0</version></dependency><!-- 需要用的数据库 JDBC 驱动 --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><version>8.0.29</version></dependency><!-- 需要用的 SpringBoot 框架,1.4.0 以上 --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId><version>2.5.13</version></dependency><dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><version>2.0.43</version></dependency>

application

/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.*/package apijson.demo;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;import apijson.Log;
import apijson.framework.APIJSONApplication;
import apijson.framework.APIJSONCreator;
import apijson.orm.SQLConfig;
/*** Demo SpringBoot Application 主应用程序启动类*/
@Configuration
@SpringBootApplication
@EnableConfigurationProperties
public class DemoApplication implements WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> {public static void main(String[] args) throws Exception {SpringApplication.run(DemoApplication.class, args);Log.DEBUG = true;APIJSONApplication.init(false);  }// SpringBoot 2.x 自定义端口方式@Overridepublic void customize(ConfigurableServletWebServerFactory server) {server.setPort(8080);}// 支持 APIAuto 中 JavaScript 代码跨域请求@Beanpublic WebMvcConfigurer corsConfigurer() {return new WebMvcConfigurer() {@Overridepublic void addCorsMappings(CorsRegistry registry) {registry.addMapping("/**").allowedOriginPatterns("*").allowedMethods("*").allowCredentials(true).maxAge(3600);}};}static {// 使用本项目的自定义处理类APIJSONApplication.DEFAULT_APIJSON_CREATOR = new APIJSONCreator<Long>() {@Overridepublic SQLConfig createSQLConfig() {return new DemoSQLConfig();}};}
}

config

/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.*/package apijson.demo;import com.alibaba.fastjson.annotation.JSONField;import apijson.framework.APIJSONSQLConfig;/**SQL 配置 */
public class DemoSQLConfig extends APIJSONSQLConfig {static {DEFAULT_DATABASE = DATABASE_MYSQL;  // TODO 默认数据库类型,改成你自己的DEFAULT_SCHEMA = "apijson";  // TODO 默认数据库名/模式,改成你自己的,默认情况是 MySQL: sys, PostgreSQL: public, SQL Server: dbo, Oracle://表名映射,隐藏真实表名,对安全要求很高的表可以这么做TABLE_KEY_MAP.put("User", "apijson_user");TABLE_KEY_MAP.put("Privacy", "apijson_privacy");}@Overridepublic String getDBVersion() {return "5.7.22";  // "8.0.11";  // TODO 改成你自己的 MySQL 或 PostgreSQL 数据库版本号  // MYSQL 8 和 7 使用的 JDBC 配置不一样}@JSONField(serialize = false)  // 不在日志打印 账号/密码 等敏感信息@Overridepublic String getDBUri() {return "jdbc:mysql://localhost:3306?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8"; // TODO 改成你自己的,TiDB 可以当成 MySQL 使用,默认端口为 4000}@JSONField(serialize = false)  // 不在日志打印 账号/密码 等敏感信息@Overridepublic String getDBAccount() {return "root";  // TODO 改成你自己的}@JSONField(serialize = false)  // 不在日志打印 账号/密码 等敏感信息@Overridepublic String getDBPassword() {return "123456";  // TODO 改成你自己的,TiDB 可以当成 MySQL 使用, 默认密码为空字符串 ""}
}

controller

/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.*/package apijson.demo;import java.net.URLDecoder;
import java.util.Map;import javax.servlet.http.HttpSession;import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import apijson.RequestMethod;
import apijson.StringUtil;
import apijson.framework.APIJSONController;
import apijson.orm.Parser;
/**请求路由入口控制器,包括通用增删改查接口等,转交给 APIJSON 的 Parser 来处理*/
@RestController
@RequestMapping("")
public class DemoController extends APIJSONController<Long> {@Overridepublic Parser<Long> newParser(HttpSession session, RequestMethod method) {return super.newParser(session, method).setNeedVerify(false);  // TODO 这里关闭校验,方便新手快速测试,实际线上项目建议开启}/**增删改查统一接口,这个一个接口可替代 7 个万能通用接口,牺牲一些路由解析性能来提升一点开发效率*/@PostMapping(value = "{method}")  // 如果和其它的接口 URL 冲突,可以加前缀,例如改为 crud/{method} 或 Controller 注解 @RequestMapping("crud")@Overridepublic String crud(@PathVariable String method, @RequestBody String request, HttpSession session) {return super.crud(method, request, session);}/**全能增删改查接口,可同时进行 增、删、改、查 多种操作,* 通过 @method: "POST", @gets: { "Privacy":"Privacy-CIRCLE", "User": { "@role":"LOGIN", "tag":"User" } } 等关键词指定*/@PostMapping(value = "crud")  // 直接 {method} 或 apijson/{method} 会和内置网页的路由有冲突// @Overridepublic String crudAll(@RequestBody String request, HttpSession session) {return newParser(session, RequestMethod.CRUD).parse(request);}/**增删改查统一接口,这个一个接口可替代 7 个万能通用接口,牺牲一些路由解析性能来提升一点开发效率*/@PostMapping("{method}/{tag}")  // 如果和其它的接口 URL 冲突,可以加前缀,例如改为 crud/{method}/{tag} 或 Controller 注解 @RequestMapping("crud")@Overridepublic String crudByTag(@PathVariable String method, @PathVariable String tag, @RequestParam Map<String, String> params, @RequestBody String request, HttpSession session) {return super.crudByTag(method, tag, params, request, session);}
}

初始化脚本

[初始化脚本](https://gitee.com/APIJSON/APIJSON-Demo/blob/master/MySQL/sys.sql)

请求样例

  1. 请求
curl --location --request POST 'http://localhost:8080/get' \
--header 'Content-Type: application/json' \
--data-raw '{"User[]":{"count":3,"User":[]}
}'
  1. 返回
{"User[]": [[],{"$ref": "$.User\\[\\][0]"},{"$ref": "$.User\\[\\][0]"}],"ok": true,"code": 200,"msg": "success","debug:info|help": " \n提 bug 请发请求和响应的【完整截屏】,没图的自行解决! \n开发者有限的时间和精力主要放在【维护项目源码和文档】上! \n【描述不详细】 或 【文档/常见问题 已有答案】 的问题可能会被忽略!! \n【态度 不文明/不友善】的可能会被踢出群,问题也可能不予解答!!! \n\n **环境信息**  \n系统: Windows 10 10.0 \n数据库: DEFAULT_DATABASE = MYSQL \nJDK: 1.8.0_101 amd64 \nAPIJSON: 6.3.0 \n   \n【常见问题】:https://github.com/Tencent/APIJSON/issues/36 \n【通用文档】:https://github.com/Tencent/APIJSON/blob/master/Document.md \n【视频教程】:https://search.bilibili.com/all?keyword=APIJSON","time": 1717495293436,"sql:generate|cache|execute|maxExecute": "0|0|0|200","depth:count|max": "2|5","time:start|duration|end|parse|sql": "1717495293434|2|1717495293436|2|0"
}
http://www.hrbkazy.com/news/35671.html

相关文章:

  • 大学校园网站建设方案优化设计三年级下册数学答案
  • 淄博做网站推广公司万物识别扫一扫
  • wordpress 页面简码友链对网站seo有帮助吗
  • 湖南省城乡建设勘测院 网站长沙百度网站排名优化
  • 深圳网站建设 案例爱站工具查询
  • 泉州(晋江)网站建设百度搜索指数的数据来源
  • 网站栏目页优化广州seo好找工作吗
  • wordpress 源码交付怎样优化网络
  • 会员管理网站模板谷歌浏览器app
  • wordpress数据库域名seo整站优化技术培训
  • 无为做网站云速seo百度点击
  • wordpress 找站点 百度一下
  • 郑州同济医院口碑怎样seo外链增加
  • 坦克大战网站开发课程设计报告市场调研怎么做
  • wordpress插件安装不seo诊断分析在线工具
  • 温州网站制作哪家好西安网站建设排名
  • 手机建站官网沈阳网站制作公司
  • 建设部网站官网证书编号外贸网站外链平台
  • 删除网站留言板功能互动网站建设
  • 自己的公司怎么做网站小红书推广方式
  • 建设银行网站登录首页百度推广代理公司哪家好
  • 游戏网站设计书百度竞价推广代理
  • 新浪博客怎么给自己网站做链接怎么制作公司网页
  • 网站设计与规划论文seo公司多少钱
  • 网站制作 网络推广营销活动
  • 免费政府网站2022年最新热点素材
  • 丰台手机网站设计公司设计网站
  • 网站建设的工作全球搜索引擎网站
  • 泉做网站的公司百度公司图片
  • 点创网站建设长春模板建站代理