@36node/kanban 中文文档教程
@36node/kanban
看板服务,提供项目、里程碑、工单、泳道等服务
Development
# prepare service with docker
docker-compose -d
# install dependencies
yarn
# start service
yarn start
# if we want to start service as production
# NODE_ENV=production yarn start
# use postman to check api
yarn test:int
Folder structures
bin
./src
├── api
├── config
├── lib
├── middleware
├── services
├── app.js
├── index.js
├── server.js
└── task.js
- bin: 受限于 nodejs 的原生能力限制,该目录下要求采用 commonjs 写法; bin 目录用于辅助项目执行。
- src: source 目录只负责输出模块。
- api: 自动生成的 api 目录包含 koa 桩代码
- config: 配置入口,用 dotenv
- lib: 基础库
- middleware: koa 中间件
- services: api 的实现
- app.js: 主程序
- index.js: 引用目录
- server.js: 服务器启动入口
- task.js: 任务入口
目录引用原则:
- config 文件是唯一的例外
- services and tasks 引用 models
- lib 目录可以被任何文件引用
- lib 目录内部不要出现交叉引用
default token
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJ1c2VyIjp7InJvbGVzIjpbIkFETUlOIiwiVVNFUiJdfX0.XA1kE_UdbOsU0rfmG3g1y3SpJ5aFVzPGFBHihVXv58sNatweqLHPEUAwhqobgKgmAbaKa3dlYrXEpHESHZ7AJgQYCfSeVxtsKyoQmcq9OYA0iFcH5oCWQgYqfeWJPOroMlMdNQax5kG-GkuaFbIiwiw-9j_ACS8CSPO9Oq2dQCA
visit jwt.io for more.
{
"sub": "1234567890",
"name": "John Doe",
"iat": 1516239022,
"user": {
"roles": ["ADMIN", "USER"]
}
}
postman
# 安装 fastman
yarn global add @36node/fastman
# You can get your key from the [integrations dashboard](https://go.postman.co/integrations/services/pm_pro_api)
fastman config -a <your-postman-api-key>
# list all your collections in your postman
fastman ls
# import file into postman, import data.json env.json by your self
fastman import ./test/xxxx/collection.json
# export file from postman
fastman export "Petstore Service" ./test/xxxx/collection.json
Url Pattern
Find more in @36node/sketch/docs/url.md
权限定义
动态角色
- PO 指 project owner
- PM 指 project manager
- CANDIDATE 指工单候选人
- EXECUTOR 指工单执行者
固定角色
- USER(保留角色): 普通用户,其实是一个无角色
- ADMIN(保留角色): 包含所有角色的所有权限,测试中不一一测试,单元测试中做一次 ADMIN 角色解析,看是否能够解析成所有角色即可。
Contributing
- Create your feature branch:
git checkout -b feature/something
- Commit your changes:
git commit -am 'feat: something'
- Push to the branch:
git push -u origin feature/something
- Submit a pull request :D
Author
kanban © 36node
Authored and maintained by 36node with help from contributors (list).
github.com/zzswang · GitHub @36node