Use koa + apollo-server-koa book: (https://oneqljs.github.io/oneQL/book/)
// src/index.ts
import oneql from 'oneql'
import typeDefs from './types'
import resolvers from './resolvers'
new oneql({
schema: {
typeDefs,
resolvers
},
context: async ({ ctx }) => {
return {
ctx
}
}
})
query db($key: String, $ext: [ExtensionType]){
hello
city(request: {key: $key, ext: $ext } ) {
datainfo{
CountryId
country
type
}
}
}
{"key":"D", "ext": [{ "key":"2", "value":"1"}] }
query simple{
seatSimple {
resultList{
fInfo{
fNo
}
}
}
}
const server = new ApolloServer({
typeDefs,
// mocks
resolvers
// playground: false // false为关闭
})
MIT