当前位置: 首页 > 软件库 > 大数据 > 数据查询 >

sapper-typescript-graphql-template

授权协议 MIT License
开发语言 Java
所属分类 大数据、 数据查询
软件类型 开源软件
地区 不详
投 递 者 萧晔
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

�� Sapper with TypeScript and GraphQL project base

What is this?

This is an extension to the official Sapper Rollup template with TypeScript preprocessing and a GraphQL server through TypeGraphQL (Apollo Server).

If you're looking for something with much, much more bundled in, check out my opinionated project base.

�� Project Status

This project base will continue to be maintained until SvelteKit is ready.

Once you are prepared to migrate, check out the Svelte Adders project for information about how to recreate this project base's functionality. You should specifically look at svelte-add-graphql.

Read on to use this project base today:

�� Copy

Choose either to clone or fork depending on your preference.

�� Clone

git clone https://github.com/babichjacob/sapper-typescript-graphql-template

�� Fork

Click the Use this template button on this project's GitHub page.

⬇️ Install Dependencies

cd sapper-typescript-graphql-template
npm install  # pnpm also works

�� Usage

�� Development

npm run dev

�� Building for Production

npm run prod

�� Exporting a Static Site

Your GraphQL server will not be exported with the rest of the site.

npm run export

Configuration

Web app

Many of the fields in static/manifest.json (short_name, name, description, categories, theme_color, and background_color) are filled with demonstrative values that won't match your site. Similarly, you've got to take new screenshots to replace the included static/screenshot-1.png and static/screenshot-2.png files. If you want, you can add app shortcut definitions for "add to home screen" on Android. Once you change theme_color, update the meta name="theme-color" tag in src/template.html to match.

The Apple touch icon, favicon, and logo- files (also all in the static directory) are created by placing the logo within a "safe area" centered circle that takes up 80% of the canvas's dimension. For instance, the constraining circle in logo-512.png is 512 × 0.80 = 409.6 ≈ 410 pixels wide and tall.

�� Source maps

This project base comes with source maps enabled during development and disabled during production for the best compromise between performance and developer experience. You can change this behavior through the sourcemap variable in rollup.config.js.

�� Optionally removing the GraphQL server

  1. Remove these lines in src/server.ts:

    1. import { createApolloServer } from "./graphql";
    2. const apolloServer = await createApolloServer();
    3. apolloServer.applyMiddleware({ app, path: graphqlPath });
  2. Remove the now-useless graphqlPath parameter to createSapperAndApolloServer in src/server.ts. This is also a good opportunity to rename the function since there is no longer an Apollo Server

  3. Delete the src/graphql folder

  4. Uninstall the apollo-server-express, bufferutil, class-validator, graphql, reflect-metadata, type-graphql, and utf-8-validate packages

�� Help! I have a question

Create an issue and I'll try to help.

�� Fix! There is something that needs improvement

Create an issue or pull request and I'll try to fix.

I'm sorry, because of my skill level and the fragility of (the combination of) some of these tools, there are likely to be problems in this project. Thank you for bringing them to my attention or fixing them for me.

�� License

MIT


This README was generated with ❤️ by readme-md-generator

  • Schema 是用于定义数据结构的,比如说,User对象中有哪些属性,对象与对象之间是什么关系等。 参考官网文档:http://graphql.cn/learn/schema/ Schema定义结构 schema { #定义查询 query: UserQuery } type UserQuery { #定义查询的类型 user(id:ID) : User #指定对象以及参数类

  • String Literal Types 直接使用文字当做类型。然后这个类型的变量就只能为这些值 type Easing = "ease-in" | "ease-out" | "ease-in-out"; interface A { name: 'xxx' } let B: 'xxx' Numeric Literal Types 直接使用数字当做类型。然后这个类型的变量就只能为这些值 t

  • 将多个相同的声明合并为一个 接口 interface 合并 如果被合并的接口有相同的 key(key 为非函数成员),但是他们的 key 的值对应类型不一致,那么会报错。 对于函数成员,如果他们的 key 相同,但是函数类型不一致,那么会被当做函数重载 namespaces 合并 对于使用 export 导出的成员,会被合并 namespace Animals { export class Z

 相关资料
  • GraphQL + MongoDB express server (in Typescript) This is just a starter example on how to build a GraphQL server with MongoDB database in Typescript. The advanage of this solution is a strong type che

  • Airbnb Clone - GraphQL Server Example with Prisma This project demonstrates how to build a production-ready application with Prisma and graphql-yoga. The API provided by the GraphQL server is the foun

  • express-graphql-typescript-boilerplate A GraphQL starter kit for building amazing API's in TypeScript and with Express.js framework. This seed repository has a complete GraphQL starter kit written in

  • 快速开始 GraphQL 是一种用于 API 的查询语言。这是 GraphQL 和 REST 之间一个很好的比较 (译者注: GraphQL 替代 REST 是必然趋势)。在这组文章中, 我们不会解释什幺是 GraphQL, 而是演示如何使用 @nestjs/GraphQL 模块。 GraphQLModule 只不过是 Apollo 服务器的包装器。我们没有造轮子, 而是提供一个现成的模块, 这让

  • GraphQL 既是一种用于 API 的查询语言也是一个满足你数据查询的运行时。 GraphQL 对你的 API 中的数据提供了一套易于理解的完整描述,使得客户端能够准确地获得它需要的数据,而且没有任何冗余,也让 API 更容易地随着时间推移而演进,还能用于构建强大的开发者工具。 向你的 API 发出一个 GraphQL 请求就能准确获得你想要的数据,不多不少。 GraphQL 查询总是返回可预测

  • TypeScript and Koa GraphQL Server Template This is a koa GraphQL template build with typescript Include Koa2 apollo-server-koa v2 GraphQL(use type-graphql) mongodb (use mongoose + typegoose as orm) es