3.18.2 • Published 1 month ago

@midwayjs/leoric v3.18.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

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

MIT

3.18.2

1 month ago

3.16.6

4 months ago

3.16.8

4 months ago

3.17.0

3 months ago

3.18.0

2 months ago

3.17.1

3 months ago

3.16.2

6 months ago

3.16.5

4 months ago

3.16.4

5 months ago

3.16.1

7 months ago

3.16.0

7 months ago

3.15.11

7 months ago

3.15.10

7 months ago

3.15.8

7 months ago

3.15.6

8 months ago

3.15.2

9 months ago

3.15.1

9 months ago

3.15.0

9 months ago

3.14.12

9 months ago

3.14.11

10 months ago

3.14.7

10 months ago

3.14.4

10 months ago

3.14.3

10 months ago

3.14.0

10 months ago

3.13.9

11 months ago

3.13.8

11 months ago

3.13.7

11 months ago

3.13.6

11 months ago

3.13.5

12 months ago

3.13.0

1 year ago

3.12.10

1 year ago

3.12.8

1 year ago

3.12.3

1 year ago

3.12.2

1 year ago

3.12.1

1 year ago

3.12.0

1 year ago

3.0.0

1 year ago