3.16.1 • Published 4 days ago

@midwayjs/leoric v3.16.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 days 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.16.1

4 days ago

3.16.0

7 days ago

3.15.11

18 days ago

3.15.10

24 days ago

3.15.8

1 month ago

3.15.6

2 months ago

3.15.2

2 months ago

3.15.1

3 months ago

3.15.0

3 months ago

3.14.12

3 months ago

3.14.11

3 months ago

3.14.7

4 months ago

3.14.4

4 months ago

3.14.3

4 months ago

3.14.0

4 months ago

3.13.9

5 months ago

3.13.8

5 months ago

3.13.7

5 months ago

3.13.6

5 months ago

3.13.5

5 months ago

3.13.0

6 months ago

3.12.10

6 months ago

3.12.8

7 months ago

3.12.3

9 months ago

3.12.2

9 months ago

3.12.1

9 months ago

3.12.0

9 months ago

3.0.0

10 months ago