Code Monkey home page Code Monkey logo

midway-base's Introduction

midway-base

我的想法是根据TypeORM模型定义,快速生成crud

1)配置数据源

{
  type: 'mysql',
  host: '127.0.0.1',
  port: 3306,
  username: 'root',
  password: '',
  database: 'demo',
  synchronize: true, // 如果第一次使用,不存在表,有同步的需求可以写 true,注意会丢数据
  logging: true,
}

2)定义模型

比如定义如下

{
  User:{
    name: string,
    username: string,
    email: string,
    phone: string,
    website: string,
    company: string,
  },
  Post:{
    name: string,
    title: string,
    body: string,
    userId: User.id,
  }
}

如果想定制,可以扩展属性。

{
  User:{
    name: string,
    username: {
      type: string,
      nullable: true,
      default: "i5ting"
    },
  }
}

3)执行命令,生成代码

$ base abc.json

4)预览

$ npm run dev

midway-base's People

Contributors

i5ting avatar liees avatar

Stargazers

 avatar code_for_the_poem avatar

Watchers

 avatar  avatar

Forkers

liees

midway-base's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.