MCPcopy Index your code
hub / github.com/brickyang/egg-ts-boilerplate

github.com/brickyang/egg-ts-boilerplate @v1.0.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.1 ↗ · + Follow
14 symbols 20 edges 12 files 0 documented · 0% updated 7y ago★ 62
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

English

这是一个在 Egg.js 中使用 TypeScript 的示例,演示了如何在 controllerservice、配置、数据库、定时任务和扩展等概念中使用 TypeScript。

快速使用

$ npm install
$ npm run tsc
$ npm run dev

// 浏览器访问 http://127.0.0.1:7001 (如果 7001 被占用也可能会使用其他端口).

本示例中使用了 egg-mong-native 插件。这是一个实现了 MongoDB 官方 Driver 的插件,用来在 Egg.js 应用中使用 MongoDB。该插件默认是关闭的,因为它要求环境中有已启动的 MongoDB 实例。

Egg.js 本身不是用 TypeScript 写的,但是它提供了 index.d.ts,所以你可以自由地在自己的应用层面使用 TypeScript。其关键点就是如何写自己的 index.d.ts 来声明所有接口。

这个示例遵循微软官方建议,使用一个唯一的“大” index.d.ts 文件,而没有为每个模块使用单独的 index.d.ts

扩展阅读: 如何在 Egg.js 中使用 TypeScript

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Class 6
Interface 3
Method 3
Function 2

Languages

TypeScript100%

Modules by API surface

app/service/home.ts4 symbols
index.d.ts3 symbols
app/controller/home.ts3 symbols
config/config.default.ts2 symbols
app/schedule/task.ts1 symbols
app/extend/application.ts1 symbols

For agents

$ claude mcp add egg-ts-boilerplate \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page