create-tell
创建EggJS项目的脚手架:整合微信公众平台基本服务
技术选型
数据库
插件
- 表单验证插件:egg-validate
- 跨域设置插件:egg-cors
- 国际化插件:egg-i18n
辅助
如何使用
安装模块
$ npm init tell? Please
下载模板
在 package.json 指定 egg.framework,默认为 egg
修改配置
指定配置文件覆盖数据库地址
/** * 跨域设置 * @member Config#mp * @property * @property * @property * @property * @property */ configmp = appId: '' appSecret: '' mchId: '' apiKey: '' notifyUrl: '' ; /** * 高性能缓存数据库 * @member Config#redis * @property * @property * @property * @property */ configredis = client: host: processenvEGG_REDIS_HOST || '127.0.0.1' port: processenvEGG_REDIS_PORT || 6379 password: processenvEGG_REDIS_PASSWORD || '' db: processenvEGG_REDIS_DB || '10' ; /** * 文档型数据库 * @member Config#mongoose * @property * @property */ configmongoose = url: 'mongodb://localhost:27017/teller' options: useNewUrlParser: true autoIndex: true useCreateIndex: true ; /** * 安全设置 * @member Config#security * @property * @property */ configsecurity = domainWhiteList: csrf: enable: false ; /** * 性能监控 * @member Config#alinode * @property * @property */ configalinode = appid: '' secret: '' ;
启动项目
$ npm run dev
集成开发环境
建议使用VSCode,并添加如下扩展
- eggjs,本地调试应用
- ESLint,检测代码质量
- vscode-icons,美化大纲排版