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

汕头网站优化网站seo外包价格

汕头网站优化,网站seo外包价格,男女做爰免费网站,成都房产网安居客GraphQL介绍 GraphQL#xff08;Graph Query Language#xff09;是一种用于API的查询语言和运行时环境#xff0c;由Facebook于2012年创建并在2015年公开发布。与传统的RESTful API相比#xff0c;GraphQL提供了更灵活、高效和强大的数据查询和操作方式。 以下是GraphQL… GraphQL介绍 GraphQLGraph Query Language是一种用于API的查询语言和运行时环境由Facebook于2012年创建并在2015年公开发布。与传统的RESTful API相比GraphQL提供了更灵活、高效和强大的数据查询和操作方式。 以下是GraphQL的一些主要特点和概念 灵活性 客户端可以精确指定需要的数据而不会获得多余或不需要的信息。这允许前端应用程序更有效地获取所需的数据减少了不必要的数据传输和处理。单一端点 与RESTful API不同GraphQL通常只有一个端点客户端可以在一个请求中指定所需的所有数据。这消除了多个端点的复杂性提高了请求效率。强类型系统 GraphQL具有明确定义的数据类型客户端和服务器之间的通信是基于这些类型的。这使得开发更容易并减少了潜在的通信错误。关联和嵌套查询 可以在一个请求中同时获取关联的数据而不需要多个请求。这样可以减少网络延迟并提高性能。实时数据 GraphQL支持实时数据传输使得客户端能够订阅数据的变化从而实时更新界面。文档性 GraphQL有强大的自描述能力通过introspection可以获取API的详细信息。这样可以轻松创建自动化工具例如自动生成文档或客户端代码。版本控制 GraphQL允许在API中逐步添加新字段和类型而不会破坏现有客户端的功能。这降低了版本迁移的难度。 GraphQL的基本概念包括 查询Query 定义客户端请求的数据结构以及所需的字段和关联关系。变更Mutation 用于对数据进行写操作的请求例如创建、更新或删除数据。订阅Subscription 允许客户端接收实时数据的推送使得应用程序能够立即响应数据的变化。类型系统 定义API中所有可能的数据类型包括标量Scalar、对象Object、枚举Enum等。 pom依赖 ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersiongroupIdorg.example/groupIdartifactIdspring-boot-test/artifactIdversion1.0-SNAPSHOT/versionpropertiesmaven.compiler.source8/maven.compiler.sourcemaven.compiler.target8/maven.compiler.targetspring-boot.version2.7.11/spring-boot.version/propertiesdependenciesdependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-graphql/artifactIdversion${spring-boot.version}/version/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-web/artifactIdversion${spring-boot.version}/version/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-actuator/artifactIdversion${spring-boot.version}/version/dependency/dependenciesbuildpluginsplugingroupIdorg.springframework.boot/groupIdartifactIdspring-boot-maven-plugin/artifactId/plugin/plugins/buildpluginRepositoriespluginRepositoryidspring-snapshots/idnameSpring Snapshots/nameurlhttps://repo.spring.io/snapshot/urlsnapshotsenabledtrue/enabled/snapshots/pluginRepositorypluginRepositoryidspring-milestones/idnameSpring Milestones/nameurlhttps://repo.spring.io/milestone/urlsnapshotsenabledfalse/enabled/snapshots/pluginRepository/pluginRepositories/project实体类 两个实体类Book 和 Author package com.testcode.model;import java.util.Arrays; import java.util.List;public class Author {private String id;private String firstName;private String lastName;public Author(String id, String firstName, String lastName) {this.id id;this.firstName firstName;this.lastName lastName;}private static ListAuthor authors Arrays.asList(new Author(author-1, Joanne, Rowling),new Author(author-2, Herman, Melville),new Author(author-3, Anne, Rice));public static Author getById(String id) {return authors.stream().filter(author - author.getId().equals(id)).findFirst().orElse(null);}public String getId() {return id;}}package com.testcode.model;import java.util.Arrays; import java.util.List;public class Book {private String id;private String name;private int pageCount;private String authorId;public Book(String id, String name, int pageCount, String authorId) {this.id id;this.name name;this.pageCount pageCount;this.authorId authorId;}private static ListBook books Arrays.asList(new Book(book-1, Harry Potter and the Philosophers Stone, 223, author-1),new Book(book-2, Moby Dick, 635, author-2),new Book(book-3, Interview with the vampire, 371, author-3));public static Book getById(String id) {return books.stream().filter(book - book.getId().equals(id)).findFirst().orElse(null);}public String getId() {return id;}public String getAuthorId() {return authorId;}}Controller package com.testcode.controller;import com.testcode.model.Author; import com.testcode.model.Book; import org.springframework.graphql.data.method.annotation.Argument; import org.springframework.graphql.data.method.annotation.QueryMapping; import org.springframework.graphql.data.method.annotation.SchemaMapping; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RestController;Controller public class BookController {QueryMappingpublic Book bookById(Argument String id) {return Book.getById(id);}SchemaMappingpublic Author author(Book book) {return Author.getById(book.getAuthorId());}}application.yml配置 server:port: 9999spring:graphql:graphiql:path: /graphiqlenabled: true启动类 package com.testcode;import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;import java.util.Arrays;SpringBootApplication public class Application {public static void main(String[] args) {SpringApplication.run(Application.class, args);} } 浏览器访问调试窗口 http://localhost:9999/graphiql?path/graphql 输入查询语句 query bookDetails {bookById(id: book-3) {idnamepageCountauthor {key:id -- 别名映射firstNamelastName}} }
http://www.w-s-a.com/news/805871/

相关文章:

  • 微信h5在哪个网站做泰州专业网站制作公司
  • 现在.net做网站的多吗建设工程造价网
  • pc访问手机网站跳转违法网站开发人员
  • 网站前端做报名框wordpress 启动慢
  • 沈阳做网站客户多吗前端可以做网站吗
  • 网站设计规划书新媒体营销策略分析
  • dw个人网站主页怎么做天津工程信息建设网
  • 顺义做网站的公司网站页面设计基础教程
  • 安阳哪个公司做网站好企业没有做网站有的坏处
  • 网站开发有必要用php框架wordpress分页导航代码
  • wordpress建站seo鞍山制作网站哪家好
  • 网站空间流量查询上海门户网站制作
  • 网站开发技术是什么专业会的加强普法网站和普法网络集群建设
  • 上海建筑网站seo 推广
  • 乌兰察布做网站公司爱站网关键词挖掘工具站长工具
  • 白银网站建设白银申请网站空间怎么做
  • 免费炫酷网站模板网站建设需要用到什么软件有哪些
  • 电商网站开发 文献综述大型网站建设企业
  • 如何在建设部网站补录项目单仁牛商
  • 社保网站上做减员一直不审核软件程序开发
  • 网站友情链接购买天元建设集团有限公司资质
  • 南山商城网站建设哪家技术好株洲seo网站优化软件
  • 服务类网站建设18款禁用网站app直播
  • 电子商务网站建设需要物流网站开发公司
  • 网站的系统建设方式有哪些内容宁波网站建设公司
  • 网站开发 技术方案品牌建设总要求
  • 中卫网站建站设计seo专员的工作内容
  • h5商城网站是什么意思.net 网站开发框架
  • 西安网站改版的公司软件外包是什么意思
  • 网站建设了解眉山网站优化