1.0.24 • Published 3 years ago

@grafee/core v1.0.24

Weekly downloads
28
License
MIT
Repository
github
Last release
3 years ago

Grafee Core

Grafee - is the easiest way to create an awesome GraphQL API.

Getting started

yarn add @grafee/core

Technologies

Setup

To enable ES6 features, alies and import .graphql files

index.js

const { setup } = require('@grafee/core')

setup('/application.js')

setup('/application.js', true) // Run application in cluster mode

application.js

import { ApolloServer } from '@grafee/core'
import rootModule from '@/modules'

const { schema } = rootModule

const application = ApolloServer({
  schema,
  middlewares,
  engine: {
    apiKey: process.env.ENGINE_API_KEY,
    schemaTag: 'production',
  },
})

const port = process.env.PORT || 4040
application.listen({
  port,
  host: '0.0.0.0',
})

console.log(`🚀  GraphQL: http://localhost:${port + application.path}`)
console.log(`🚀  Subscriptions: ws://localhost:${port + application.subscriptions}`)

API

createModule

To create a module. Full API

import { createModule } from '@grafee/core'
import { userService } from '@/services' // @grafee/mongo
import * as typeDefs from './schema.graphql'
import * as resolvers from './resolvers'

export default createModule({
  typeDefs,
  resolvers,
  context: {
    db: userService,
  },
})

ApolloServer

import { ApolloServer } from '@grafee/core'
import { setup } from '@grafee/mongo'
import { auth } from '@/passport'
import schema from '@/modules'
import access from '@/access' // @grafee/sheild

const middlewares = [auth, access]

const application = ApolloServer({
  schema,
  middlewares,
  engine: {
    apiKey: process.env.ENGINE_API_KEY,
    schemaTag: 'production',
  },
})

const port = process.env.PORT || 4040
application.listen({
  port,
  host: '0.0.0.0',
})

console.log(`🚀  GraphQL: http://localhost:${port + application.path}`)
console.log(`🚀  Subscriptions: ws://localhost:${port + application.subscriptions}`)

MIT License

MIT License

Copyright (c) 2019 Yakauleu Uladzislau

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago