3.18.2 • Published 6 months ago
@midwayjs/leoric v3.18.2
midway leoric component
this is a sub package for midway.
Document: https://midwayjs.org
Usage
// src/configuration.ts
import { Configuration, ILifeCycle } from '@midwayjs/core';
import * as leoric from '@midwayjs/leoric';
@Configuration({
imports: [
leoric,
],
})
export class ContainerLifeCycle implements ILifeCycle {}
// src/config/config.default.ts
export default () => {
return {
leoric: {
dataSource: {
default: {
dialect: 'sqlite',
database: path.join(__dirname, '../../', 'database.sqlite'),
sync: true,
models: [
'**/models/*{.ts,.js}'
]
},
},
},
}
}
// src/controller/user.ts
import { Controller } from '@midwayjs/core';
import { InjectModel } from '@midwayjs/leoric';
import User from '../model/user';
@Controller('/api/users')
export class UserController {
@InjectModel(User)
User: typeof User;
@Get('/')
async index() {
return await this.User.order('id', 'desc').limit(10);
}
}
License
3.18.2
6 months ago
3.16.6
8 months ago
3.16.8
8 months ago
3.17.0
7 months ago
3.18.0
6 months ago
3.17.1
7 months ago
3.16.2
10 months ago
3.16.5
9 months ago
3.16.4
9 months ago
3.16.1
11 months ago
3.16.0
11 months ago
3.15.11
11 months ago
3.15.10
12 months ago
3.15.8
12 months ago
3.15.6
1 year ago
3.15.2
1 year ago
3.15.1
1 year ago
3.15.0
1 year ago
3.14.12
1 year ago
3.14.11
1 year ago
3.14.7
1 year ago
3.14.4
1 year ago
3.14.3
1 year ago
3.14.0
1 year ago
3.13.9
1 year ago
3.13.8
1 year ago
3.13.7
1 year ago
3.13.6
1 year ago
3.13.5
1 year ago
3.13.0
1 year ago
3.12.10
1 year ago
3.12.8
1 year ago
3.12.3
2 years ago
3.12.2
2 years ago
3.12.1
2 years ago
3.12.0
2 years ago
3.0.0
2 years ago