[Apollo Server] Get started with Apollo Server
Get started with apollo server with node.js:
Install:
npm install --save apollo-server graphql
index.js:
const { ApolloServer, gql } = require('apollo-server'); const books = [
{
title: 'Harry Potter and the Chamber of Secrets',
author: 'J.K. Rowling',
},
{
title: 'Jurassic Park',
author: 'Michael Crichton',
},
]; const typeDefs = gql`
# Comments in GraphQL are defined with the hash (#) symbol.
type Book {
"Title of the book, this will appear in graphql playground"
title: String
author: String
} # The "Query" type is the root of all GraphQL queries.
# (A "Mutation" type will be covered later on.)
type Query {
books: [Book]
}
`; // Resolvers define the technique for fetching the types in the
// schema. We'll retrieve books from the "books" array above.
const resolvers = {
Query: {
books: () => books,
},
}; const server = new ApolloServer({ typeDefs, resolvers }); server.listen().then(({ url }) => {
console.log(`[Apollo Server] Get started with Apollo Server的更多相关文章
- 如何转换SQL Server 2008数据库到SQL Server 2005
背景介绍: 公司一套系统使用的是SQL SERVER 2008数据库,突然一天收到邮件,需要将这套系统部署到各个不同地方(海外)的工厂,需要在各个工厂部署该数据库,等我将准备工作做好,整理文档 ...
- Ubuntu Server 14.04升级Ubuntu Server 16.04
Ubuntu Server 14.04升级Ubuntu Server 16.04 :转 http://blog.csdn.net/chszs 1.终端下执行命令 $ sudo apt-get upda ...
- 第三篇——第二部分——第五文 配置SQL Server镜像——域环境SQL Server镜像日常维护
本文接上面两篇搭建镜像的文章: 第三篇--第二部分--第三文 配置SQL Server镜像--域环境:http://blog.csdn.net/dba_huangzj/article/details/ ...
- sharepoint 2013 reporting services 远程server返回错误: (500) 内部server错误。
在sharepoint 2013部署reporting services过程中,点击管理中心,server上的服务.系统配置.提示了一个错误: 远程server返回错误: (500) 内部server ...
- SQL Server 复制 - 发布订阅(SQL Server 数据同步)
原文:SQL Server 复制 - 发布订阅(SQL Server 数据同步) SQL Server的同步是通过SQL Server自带的复制工具来实现的,分发布和订阅2大步. A,复制-发布 发布 ...
- Exchange Server 2010升级到Exchange Server 2016
Hello各位小伙伴们,失踪人口回归啦~~~这次和大家分享Exchange Server 2010升级到Exchange Server 2016的方法.正式开始前先啰嗦几句,为什么我要写这篇文章呢?一 ...
- 【阿里云】在 Windows Server 2016 下使用 FileZilla Server 安装搭建 FTP 服务
Windows Server 2016 下使用 FileZilla Server 安装搭建 FTP 服务 一.安装 Filezilla Server 下载最新版本的 Filezilla Server ...
- SharePoint Server 2016 - Configure Office Online Server
Step 1: Create the binding between SharePoint 2016 and Office Web Apps Server To get started, open ...
- 安装sql server 2008 提示错误 SQL Server 2005 Express 工具。 失败
安装sql server 2008 management,提示错误:Sql2005SsmsExpressFacet 检查是否安装了 SQL Server 2005 Express 工具. 失败,已安装 ...
随机推荐
- java实现短连接
现在比较流行短连接,例如新浪微博,腾讯等等公司都开始使用短连接. ① 将长网址用md5算法生成32位签名串,分为4段,,每段8个字符: ② 对这4段循环处理,取每段的8个字符, 将他看成16进制字符串 ...
- nginx配置C compiler cc is not found
1.需求 linux安装个编译器 参考资料:http://blog.csdn.net/testcs_dn/article/details/51461750
- jira7.3/7.2安装、中文及破解
jira是Atlassian公司出品的项目与事务跟踪工具,被广泛应用于缺陷跟踪(bug管理).客户服务.需求收集.流程审批.任务跟踪.项目跟踪和敏捷管理等工作领域. 现在我们来介绍,有关jira安装. ...
- 服务器 阿里云服务器Ubuntu挂载数据盘
服务器 阿里云服务器Ubuntu挂载数据盘 转自:http://www.codingyun.com/article/24.html coding云运行在阿里云的Ubuntu 12.04 64位操作系 ...
- HDU5187 zhx's contest
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission ...
- mysql 共享空间转为独立表空间
由于以前的mysql配置为共享表空间,服务器空间不足,清理日志表里的数据后,数据库并没缩小,照成空间浪费,现在修改为独立表空间 #独立表空间innodb_file_per_table=1 #停止事物日 ...
- 使用log4j2分离系统日志与业务日志
前一篇文章介绍了log4j2 扩展日志级别,支持将系统日志与业务处理日志拆分,现在介绍一下通过日志级别将系统日志与业务日志分类,要达到这个目的很容易,只需要配置一下log4j的xml文件: <? ...
- This template requires a more recent version of the Android Eclipse plugin. Please update from versi
新建android project的时候遇到这个错误: 解决方法:①直接修改F:\JAVA\SDK\android-sdk\tools\templates\activities (对应你的JAVA S ...
- 树上各种DFS姿势算法笔记
树是指由n个点,n-1条边构成的联通无向图.如果有一棵树,它的每一条边(u,v)都有一个权值l(u,v),我们把这样的树称作带权树. 我们知道对于树上的任意两个点,他们之间的路径是唯一的.对于两个点u ...
- NEUQOJ 1999: 三角形or四边形?【搜索联通块/模拟】
http://newoj.acmclub.cn/problems/1999 1999: 三角形or四边形? 描述 题目描述: JiangYu很无聊,所以他拿钉子在板子上戳出了一个由.#组成的10*10 ...