-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add type doc to build doc for project. (#282)
- Loading branch information
Showing
9 changed files
with
165 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Development | ||
|
||
## Environment | ||
|
||
You should start a redis service. And the redis's default port is 6379. You can edit it at `kuai.config.ts` | ||
|
||
```typescript | ||
import { KuaiConfig } from '@ckb-js/kuai-core'; | ||
|
||
const config: KuaiConfig = { | ||
REDIS_PORT: 6379, | ||
}; | ||
|
||
export default config; | ||
``` | ||
|
||
## Quick Start | ||
|
||
```sh | ||
git clone <remote_repository_location> | ||
cd <project name> | ||
npm install | ||
npm run dev | ||
``` | ||
|
||
It will start a service at `http://127.0.0.1:3000`, try to open [hello](http://127.0.0.1:3000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
import { KuaiRouter } from '@ckb-js/kuai-io'; | ||
import { BaseController, Controller, Get, Query } from '@ckb-js/kuai-io'; | ||
import { appRegistry } from './actors'; | ||
import { Actor } from '@ckb-js/kuai-models'; | ||
import { Actor, ActorNotFoundException } from '@ckb-js/kuai-models'; | ||
|
||
const router = new KuaiRouter(); | ||
@Controller('/') | ||
export default class AppController extends BaseController { | ||
@Get('/') | ||
async hello(@Query('name') name: string) { | ||
const appActor = appRegistry.find('local://app'); | ||
|
||
router.get('/', async (ctx) => { | ||
const appActor = appRegistry.find('local://app'); | ||
if (!appActor) { | ||
throw new ActorNotFoundException('local://app'); | ||
} | ||
|
||
if (!appActor) { | ||
return ctx.err('not found app actor'); | ||
} | ||
|
||
await Actor.call(appActor.ref.uri, appActor.ref, { | ||
pattern: 'normal', | ||
value: { | ||
type: 'hello', | ||
hello: { | ||
name: ctx?.payload?.query?.name, | ||
await Actor.call(appActor.ref.uri, appActor.ref, { | ||
pattern: 'normal', | ||
value: { | ||
type: 'hello', | ||
hello: { | ||
name, | ||
}, | ||
}, | ||
}, | ||
}); | ||
}); | ||
|
||
ctx.ok(`hello ${ctx?.payload?.query?.name || 'world'}`); | ||
}); | ||
|
||
export { router }; | ||
return `hello ${name || 'world'}`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"$schema": "https://typedoc.org/schema.json", | ||
"entryPoints": ["./src/main.ts", "./**/*.controller.ts"], | ||
"out": "docs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters