1.0.7 • Published 5 years ago

egg-tell-basic v1.0.7

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

egg-tell-basic

npm version

基于EggJS的企业内部框架

技术选型

数据库

插件

辅助

如何使用

安装模块

npm i egg-tell-basic

引入框架

package.json 指定 egg.framework,默认为 egg

{
  "egg": {
    "declarations": true,
    "framework": "egg-tell-basic"
  },
  "dependencies": {
    "egg": "^2.15.1",
    "egg-scripts": "^2.11.0",
    "egg-tell-basic": "^1.0.5"
  },
}

添加配置

指定配置文件覆盖数据库地址

// 文档型数据库
config.mongoose = {
    url: 'mongodb://localhost:27017/teller',
    options: {
        useNewUrlParser: true,
        autoIndex: true,
        useCreateIndex: true,
    },
};

// 高性能缓存
config.redis = {
    client: {
        host: process.env.EGG_REDIS_HOST || '127.0.0.1',
        port: process.env.EGG_REDIS_PORT || 6379,
        password: process.env.EGG_REDIS_PASSWORD || '',
        db: process.env.EGG_REDIS_DB || '10',
    },
};

// 安全设置
config.security = {
    domainWhiteList: [],
    csrf: {
      enable: false,
    },
};

// 性能监控
config.alinode = {
    appid: '',
    secret: '',
};

// 国际化
config.i18n = {
    defaultLocale: 'zh-CN',
};

默认插件配置

  • mongoose
  • redis
  • validate
  • cors
  • alinode

集成开发环境

建议使用VSCode,并添加如下扩展