Skip to content

Commit

Permalink
Writing #68: setup.mdx
Browse files Browse the repository at this point in the history
  • Loading branch information
samchon committed May 15, 2024
1 parent 2014b0e commit 58f254c
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 13 deletions.
2 changes: 1 addition & 1 deletion website/pages/docs/features/components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export const webSocketClientMain = async () => {
};
```

> ```bash filename="console"
> ```bash filename="Terminal"
> $ npx ts-node examples/src/websocket
> 30 12 1.67 1.41 4.33
> [
Expand Down
14 changes: 4 additions & 10 deletions website/pages/docs/features/websocket.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ export interface IStatisticsCalculator {
</Tab>
</Tabs>

> ```bash filename="console"
> ```bash filename="Terminal"
> $ npx ts-node examples/src/websocket
> 30 12 1.67 1.41 4.33
> [
Expand Down Expand Up @@ -518,12 +518,6 @@ In the server side, you can take advantages of `NestJS` controller patterns, so
In the client side, you also can take advantages of automatically generated SDK (Software Development Kit) library for the client developers. With the SDK, client developers no more need to write the WebSocket connection and RPC (Remote Procedure Call) codes manually, so that development becomes much safer.
### Bootstrap
```bash
npx nestia setup
```
At first, install `Nestia` packages through `npx nestia setup` command.
```typescript filename="examples/src/nestjs/bootstrap.ts" showLineNumbers
import { WebSocketAdaptor } from "@nestia/core";
import { INestApplication } from "@nestjs/common";
Expand All @@ -539,7 +533,7 @@ export const bootstrap = async (): Promise<INestApplication> => {
};
```
After that, you've to upgrade the NestJS application to support the WebSocket server.
To utilize `TGrid` in the `NestJS`, upgrade the `NestJS` application like above.
Just call the [`WebSocketAdaptor.upgrade()`](https://nestia.io/api/classes/WebSocketAdaptor.html#upgrade) method, then you can utilize `TGrid` in the `NestJS` server.
Expand Down Expand Up @@ -978,7 +972,7 @@ export namespace statistics {
}
```
```bash filename="console"
```bash filename="Terminal"
npx nestia sdk
```
Expand Down Expand Up @@ -1105,7 +1099,7 @@ export interface IStatisticsCalculator {
</Tab>
</Tabs>
> ```bash filename="console"
> ```bash filename="Terminal"
> $ npx ts-node examples/src/nestjs
>
> [Nest] 4328 - 05/15/2024, 3:19:50 AM LOG [NestFactory] Starting Nest application...
Expand Down
2 changes: 1 addition & 1 deletion website/pages/docs/features/worker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export interface IStatisticsCalculator {
</Tab>
</Tabs>

> ```bash filename="console"
> ```bash filename="Terminal"
> $ npx ts-node examples/src/worker
> 30 12 1.67 1.41 4.33
> [
Expand Down
2 changes: 1 addition & 1 deletion website/pages/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const webSocketClientMain = async () => {
};
```

> ```bash filename="console"
> ```bash filename="Terminal"
> $ npx ts-node examples/src/websocket
> 30 12 1.67 1.41 4.33
> [
Expand Down
54 changes: 54 additions & 0 deletions website/pages/docs/setup.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { Callout, Tabs, Tab } from 'nextra-theme-docs'

## Standalone
<Tabs items={["npm", "pnpm", "yarn"]}>
<Tab>
```bash filename="Terminal"
npm install tgrid
```
</Tab>
<Tab>
```bash filename="Terminal"
pnpm install tgrid
```
</Tab>
<Tab>
```bash filename="Terminal"
yarn add tgrid
```
</Tab>
</Tabs>

If you're planning to use `TGrid` standalone, without [NestJS integration](./features/websocket/#nestjs-integration), just setup it.




## NestJS
[Nestia > Guide Documents > Setup](https://nestia.io/docs/setup/)

Otherwise, you wanna use `TGrid` with [NestJS integration](./features/websocket/#nestjs-integration), please refer to the guide documents of `nestia`.

By the way, if you want to setup it right now without reading detailed documents, just run the below commands.

<Tabs items={["npm", "pnpm", "yarn"]}>
<Tab>
```bash filename="Terminal"
npx nestia setup
npm install tgrid
```
</Tab>
<Tab>
```bash filename="Terminal"
npx nestia setup --manager pnpm
pnpm install tgrid
```
</Tab>
<Tab>
<Callout type="warning">Yarn beery is not supported.</Callout>
```bash filename="Terminal"
npx nestia setup --manager yarn
yarn add tgrid
```
</Tab>
</Tabs>

0 comments on commit 58f254c

Please sign in to comment.