在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):mercurius-js/mercurius开源软件地址(OpenSource Url):https://github.com/mercurius-js/mercurius开源编程语言(OpenSource Language):JavaScript 97.6%开源软件介绍(OpenSource Introduction):mercuriusMercurius is a GraphQL adapter for Fastify Features:
Docs
Installnpm i fastify mercurius graphql
# or
yarn add fastify mercurius graphql The previous name of this module was fastify-gql (< 6.0.0). Quick Start'use strict'
const Fastify = require('fastify')
const mercurius = require('mercurius')
const app = Fastify()
const schema = `
type Query {
add(x: Int, y: Int): Int
}
`
const resolvers = {
Query: {
add: async (_, { x, y }) => x + y
}
}
app.register(mercurius, {
schema,
resolvers
})
app.get('/', async function (req, reply) {
const query = '{ add(x: 2, y: 2) }'
return reply.graphql(query)
})
app.listen(3000) ExamplesCheck GitHub repo for more examples. AcknowledgementsThe project is kindly sponsored by: The Mercurius name was gracefully donated by Marco Castelluccio. The usage of that library was described in https://hacks.mozilla.org/2015/12/web-push-notifications-from-irssi/, and you can find that codebase in https://github.com/marco-c/mercurius. LicenseMIT |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论