@jjsoft2018/graphql-harmony
v1.2.3-alpha
Published
[![pipeline status](https://gitlab.jjsoft.kr/DONNA/graphql-harmony/badges/master/pipeline.svg)](https://gitlab.jjsoft.kr/DONNA/graphql-harmony/commits/master) [![coverage report](https://gitlab.jjsoft.kr/DONNA/graphql-harmony/badges/master/coverage.svg)](
Downloads
4
Readme
Graphql Harmony
feature & complete
- [x] graphql endpoint
- [x] graphql playground
- [x] graphql cache
- [x] net server
- [x] error handling
- [ ] cache
How to start server
import {GraphqlServer} from './src'
const server = new GraphqlServer()
server.start({
// see ./src/GraphqlServer/__types.ts IGraphqlServerOptions
}).then(({address}) => {
const info = address()
console.log(`server was started at ${info.address}::${info.port}`)
server.stop().then(() => {
console.log('server stopped')
})
})
How to create query
import {Query, Resolver, Arg} from 'type-graphql'
import {HarmonyError, Err, ErrorGroup, ErrorItem} from './src'
class MyResolverError extends ErrorGroup {
@Err() justError: ErrorItem = 'just error' as any
}
const myErrors = new MyResolverError()
@Resolver()
class MyResolver {
@Query()
getSomething(@Arg() name: string) {
if(name === 'bichi'){
// how to throw error
throw new HarmonyError(myErrors.justError)
}
return name
}
}
using suggestion
refer to ./exapmles
Options
see src/GraphqlServer/types.ts>IGraphqlServerOptions
docs
yarn docs
# and see files in ./docs