用typescript来写eggjs
由于用javasript的某种限制和不足,所以决定使用typescript来写eggjs
初始化typescript
1 | npm init egg --type=ts |
使用数据库
1 | npm i --save egg-sequelize mysql2 |
/config/plugins.ts1
2
3
4sequlize: {
enable: true,
package: 'egg-sequelize',
},
/config/config.default.ts1
2
3
4
5
6
7
8config.sequelize = {
dialect: 'mysql',
host: 'localhost',
port: 3306,
password: '123456',
database: 'eic-egg',
timezone: '+08:00',
};
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment
DisqusValine