You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/development-environment.md
+19-5Lines changed: 19 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ sidebar_label: Development Environment
6
6
7
7
## TypeScript
8
8
9
-
### Basic Configuration
9
+
### TS-Node ***(recommended way)***
10
10
11
11
To setup your development environment easily, we recommend to use [TypeScript](http://www.typescriptlang.org/).
12
12
@@ -62,7 +62,7 @@ Next, add the following scripts to your `package.json`:
62
62
-`build` will use `tsc` compiler to compile your code to JavaScript.
63
63
-`start` will run the compiled server using pure Node.
64
64
65
-
### `paths`
65
+
####`paths`
66
66
67
67
TypeScript has an **[aliasing mechanism](https://www.typescriptlang.org/docs/handbook/module-resolution.html)** that can make it easier to work with modules directories.
68
68
@@ -104,7 +104,7 @@ This way, you can now import files between modules like that:
104
104
import { SomeProvider } from'@modules/my-module';
105
105
```
106
106
107
-
### Import from `.graphql` files
107
+
####Import from `.graphql` files
108
108
109
109
You can also treat `.graphql` files as text files and import from them easily. It's useful because most IDEs detects `.graphql` files and have syntax highlighting for it.
110
110
@@ -119,7 +119,7 @@ import 'graphql-import-node'; // You should add this at the begininng of your en
119
119
import*asUserTypeDefsfrom'./user.graphql';
120
120
```
121
121
122
-
## Webpack
122
+
###Webpack
123
123
124
124
If you are using Webpack, we recommend to use **[ts-loader](https://github.com/TypeStrong/ts-loader) or [awesome-typescript-loader](https://github.com/s-panferov/awesome-typescript-loader)** to load your TypeScript files.
125
125
@@ -149,6 +149,20 @@ module.exports = {
149
149
};
150
150
```
151
151
152
+
### Babel-TypeScript
153
+
154
+
You can use Babel for TypeScript with GraphQL-Modules. [Check out this boilerplate](https://github.com/Microsoft/TypeScript-Babel-Starter)
155
+
156
+
But if you use DI, you have to decorate each property and argument in the providers manually even for the classes like below;
If you are using JavaScript in your project and not TypeScript, you can either **[add support for TypeScript](https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html)**, or use GraphQL Modules with it's JavaScript API.
@@ -159,7 +173,7 @@ If you are using [Babel](http://babeljs.io) to transpile your JavaScript files,
159
173
160
174
### Without decorators
161
175
162
-
You can use `Inject` and `Injectable` as regular functions to wrap your arguments and classes.
176
+
You can use `Inject` and `Injectable` as regular functions to wrap your arguments and classes from `tslib
Copy file name to clipboardExpand all lines: docs/introduction/subscriptions.md
+31-5Lines changed: 31 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,12 @@ title: Subscriptions
4
4
sidebar_label: Subscriptions
5
5
---
6
6
7
-
Subscriptions are GraphQL operations that watch events emitted from your backend. GraphQL-Modules supports GraphQL subscriptions with a little modification in your server code. You can **[read more](https://www.apollographql.com/docs/apollo-server/features/subscriptions.html)** about subscriptions.
7
+
Subscriptions are GraphQL operations that watch events emitted from your backend. GraphQL-Modules supports GraphQL subscriptions with a little modification in your server code. You can **[read more](https://github.com/apollographql/subscriptions-transport-ws)** about subscriptions.
8
8
9
9
Subscriptions need to have defined `PubSub` implementation in your GraphQL-Modules application.
10
10
11
11
```typescript
12
+
import { PubSub } from'graphql-subscriptions';
12
13
exportconst CommonModule =newGraphQLModule({
13
14
providers: [
14
15
PubSub
@@ -72,12 +73,37 @@ You have to export `subscriptions` from your `AppModule`, and pass it to your Gr
0 commit comments