3.18.2 • Published 2 months ago

@midwayjs/leoric v3.18.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months 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

2 months ago

3.16.6

5 months ago

3.16.8

5 months ago

3.17.0

4 months ago

3.18.0

3 months ago

3.17.1

4 months ago

3.16.2

7 months ago

3.16.5

5 months ago

3.16.4

6 months ago

3.16.1

8 months ago

3.16.0

8 months ago

3.15.11

8 months ago

3.15.10

8 months ago

3.15.8

9 months ago

3.15.6

9 months ago

3.15.2

10 months ago

3.15.1

10 months ago

3.15.0

10 months ago

3.14.12

10 months ago

3.14.11

11 months ago

3.14.7

11 months ago

3.14.4

11 months ago

3.14.3

11 months ago

3.14.0

11 months ago

3.13.9

12 months 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

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