Nice Node
Status
安装
最好在安装前申请好 appcode ,因为 appcode 会写入到某些文件中,后续手动修改可能会出现遗漏,可能影响发布。
使用 npx
启动创建新项目的手脚架工具:
npx create-nice-node
命令
启动本地服务
```sh
npm start
```
编译工程
```sh
# 编译
npm run build
# 编译并预览编译结果
npm run start:prod
```
代码检查
```sh
# 检查并返回错误结果
npm run lint
# 检查并尝试修复
npm run lint:fix
```
测试
```sh
npm test
# 查看代码覆盖率
npm run cover
```
特点
- 基于
dotenv
的配置系统 - 区分环境的配置文件
- 内置 eslint
- 内置 husky
- 使用统一的 eslint 规则
- 搭建新项目的手脚架工具,能一键创建项目
- 提供基础的 tsconfig.json
- 支持记录访问日志
- 内置日志函数
- 支持打点监控(watcher)
- 结合 PM2 ,提供基础的 ecosystem.config.js
- 可配置的代理转发
- 支持静态文件服务(可选)
- 支持 pug 模版(可选)
- 自动加载路由功能(可选)
- 支持 GraphQL(可选)
- .syncignore
- 集成 portal 发布
- deploy_scripts
- 定时任务同步机制
- 代码覆盖率
- qconfig
- ssr
- 兼容 windows 系统
- nicenode.env 参数检查
- 找 cm 将发布参数设置打包成nice-node类型,内置到portal系统
- requireAllRoutes 封装成中间件
- 内置
typescript@^3.7.5
, 支持可选链操作 - unit test
- bin
- http-proxy 对 post 的模拟没写用例
文档目录
新手入门
- 创建新项目
- 路由
- profiles
- 配置和环境变量
- 代理请求
- 解析 pug 模版
- 提供静态文件服务
- 提供 GraphQL 服务
- 记录日志
- 添加打点监控
- 自定义 web 服务器
- 部署项目
- PM2 管理多个网站
API
命令行
中间件
- access-log
- body-parser
- catch-throw
- check-urls
- graphql
- health-check
- http-proxy
- logger
- static-file
- validate
- watcher
公用模块
todo
- deploy_scripts 和 crontab 使用文件软连接