Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
fix: use new runtime api in graphql-serve (#1506)
Browse files Browse the repository at this point in the history
  • Loading branch information
Enda authored Jun 22, 2020
1 parent 8f6b461 commit 53561ff
Show file tree
Hide file tree
Showing 31 changed files with 430 additions and 689 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
working_directory: ~/graphback
docker:
# Node 8 LTS
- image: circleci/node:lts-browsers
- image: circleci/node:lts
environment:
NODE_OPTIONS: --max_old_space_size=4096
- image: circleci/postgres:latest
Expand Down
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,29 @@
"protocol": "inspector",
"args": [
"serve",
"./model",
"port=8080"
],
"cwd": "${workspaceRoot}/templates/ts-apollo-postgres-backend",
},
{
"type": "node",
"request": "launch",
"name": "CLI print-schema",
"program": "${workspaceRoot}/packages/graphql-serve/dist/index.js",
"runtimeArgs": [
"--nolazy",
"-r",
"ts-node/register"
],
"sourceMaps": true,
"protocol": "inspector",
"args": [
"print-schema",
"./model"
],
"cwd": "${workspaceRoot}/templates/ts-apollo-postgres-backend",
},
{
"type": "node",
"request": "launch",
Expand Down
24 changes: 9 additions & 15 deletions docs/intro/graphqlserve.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ You can customise the directory of the data models:
gqls serve ./path/to/models
```

You can also specify where to load the data models from with a Glob pattern:

```sh
gqls print-schema ./schema/**/*.graphql
```

You can specify which port to start the server on:

```sh
Expand All @@ -64,21 +70,9 @@ Graphback receives your data models as an input and processes them to generate a

GraphQL Serve allows you to print the resulting schema in your terminal with the `print-schema` subcommand:

```gql
$ gqlserve print-schema ./path/to/models
```

### Customising your server configuration

Graphback enabled applications use [GraphQL Config](https://graphql-config.com) to let you control your GraphQL application. Graphback specific customisations are specified in the `graphback` extension. See [Config](./config) to learn how you can customise your Graphback project configuration.

GraphQL Serve is fully compatible with GraphQL Config. Running `gqlserve [subcommand]` in the same directory as your `.graphqlrc` file will use the Graphback configuration section to find your model directory, configure global CRUD methods and execute the plugin sequence.

```sh
$ gqls serve

No port number specified.
Starting server on random available port...
$ gqls print-schema ./path/to/models
Generated schema:

Listening at: http://localhost:34059/graphql
...
```
8 changes: 8 additions & 0 deletions docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ For more advanced usage, refer to the [Runtime API](./intro/serverless) document

We have removed the `graphback openapi` CLI command, but you can still use [OpenAPI-to-GraphQL](https://github.com/IBM/openapi-to-graphql) to create a GraphQL schema from your OpenAPI specification.

#### `graphl-config` is not supported in `graphql-serve`

To use `graphql-serve` now you must use a model file:

```sh
gqls serve ./path/to/models/*.graphql --port 8080
```

### Deprecated

- `PgKnexDBDataProvider` has been deprecated in favour of `KnexDBDataProvider`.
Expand Down
3 changes: 1 addition & 2 deletions packages/graphback-cli/src/components/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { prompt as ask } from 'inquirer'
import { allTemplates, extractTemplate } from '../init/starterTemplates'
import { Template } from '../init/templateMetadata'
import { logError, logInfo } from '../utils'
import { initConfig } from './config';

/**
* Check if directory exists
Expand Down Expand Up @@ -78,7 +77,7 @@ GraphQL server successfully bootstrapped :rocket:
Next Steps:
1. Change directory into project folder - ${chalk.cyan(`cd ${name}`)}
3. Review Graphback graphqlrc.yml config file
3. Review Graphback graphqlrc.yml config file
2. Edit the .graphql file inside your model folder.
3. Depending on template you might also need to run generator:
"graphback generate" command to generate source code
Expand Down
2 changes: 0 additions & 2 deletions packages/graphback-runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ export * from "./data/NoDataError"
export * from "./service/CRUDService"
export * from './service/createCRUDService'
export * from "./service/GraphbackPubSub"
export * from "./resolvers/LayeredRuntimeResolverCreator"
export * from "./resolvers/RuntimeResolversDefinition"
export * from "./GraphbackPubSubModel"
export * from './utils/fieldTransformHelpers';

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 53561ff

Please sign in to comment.