Skip to content

Commit 7c84c15

Browse files
committed
chore(docs): tweak nexus module intro
1 parent 4fc1baf commit 7c84c15

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

website/content/040-api/01-nexus/index.mdx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ codeStyle: true
66

77
## `import ... from 'nexus'`
88

9-
This section is about the main module of the `nexus` pacakge. Of all Nexus' modules this is the one you'll find yourself using the most in a Nexus projet. The main `nexus` module exports an application singleton. It is available as the default module export. The primary components of the application are exposed via properties on the application object. For convenience these components are also exposed as named exports. If you do not like long property chains you might prefer imported the named exports. See examples of either style below.
9+
This section is about the main module of the `nexus` pacakge. Of all Nexus' modules this is the one you'll find yourself using the most in a Nexus projet. The main `nexus` module exports an application singleton. It is available as the default module export. The primary components of the application are exposed via properties on the application object. For convenience these components are also exposed as named exports. If you do not like long property chains you might prefer imported the named exports (see examples of either style later in this page). Each named export is documented on its own page. Each named export has a corollary guide page as well. Guides take time to explain concepts and motivations. The API docs focus only on dry technical details of the API.
1010

1111
> ##### A Word About Autocomplete
1212
>
1313
> Whichever import style you go with know that you can benefit from [TypeScript's auto-import feature](https://code.visualstudio.com/docs/languages/typescript#_auto-imports). To import the defualt export by name automatically you need to use the same identifier that we use internally. That identifier is `app`. Type that anywhere and you should see the option to auto-import the default export from `nexus`.
1414
15-
Each named export is documented on its own page. Each named export has a corollary guide page.
16-
1715
### Example of importing default export
1816

1917
```ts
2018
import app from 'nexus'
2119

22-
app.log.info('hello world')
20+
app.on.start(() => {
21+
app.log.info('Hello World!')
22+
})
2323

2424
app.settings.change({
2525
server: {
@@ -29,17 +29,19 @@ app.settings.change({
2929

3030
app.schema.queryType({
3131
definition(t) {
32-
t.field('foo', { type: 'String' })
32+
t.string('foo', () => 'bar')
3333
},
3434
})
3535
```
3636

3737
### Example of importing named exports
3838

3939
```ts
40-
import { schema, settings, log } from 'nexus'
40+
import { schema, settings, log, on } from 'nexus'
4141

42-
log.info('hello world')
42+
on.start(() => {
43+
log.info('Hello World!')
44+
})
4345

4446
settings.change({
4547
server: {
@@ -49,7 +51,7 @@ settings.change({
4951

5052
schema.queryType({
5153
definition(t) {
52-
t.field('foo', { type: 'String' })
54+
t.string('foo', () => 'bar')
5355
},
5456
})
5557
```

0 commit comments

Comments
 (0)