0.0.3 • Published 5 years ago

egg-typegoose v0.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

egg-typegoose

typegoose plugin for Egg.js.

NPM version npm download

Install

$ yarn add @forsigner/egg-typegoose

Usage

Plugin

// {app_root}/config/plugin.ts
const plugin: EggPlugin = {
  typegoose: {
    enable: true,
    package: '@forsigner/egg-typegoose',
  },
}

Configuration

// {app_root}/config/config.default.ts
config.typegoose = {
  url: 'mongodb://localhost:27017/test',
  options: {},
}

Create entity files

├── controller
│   └── home.ts
├── model
    ├── Post.ts
    └── User.ts

Model file

// app/model/User.ts
class User extends Typegoose {
  @prop()
  name?: string
}
export default User

Example

example

Questions & Suggestions

Please open an issue here.

License

MIT