Skip to content

ThinkTs@v2.4.4-PLUS

Latest
Compare
Choose a tag to compare
@asciphx asciphx released this 27 Feb 06:27
· 9 commits to master since this release

ThinkTs

  • Support typeorm, the best typescript ORM framework, and easily write all kinds of logic of Dao layer
  • Allow static type modification and type inference to support back-end development and maintenance
  • Modular development makes the application easier to layer and provides an easy-to-use modular management mechanism
  • AOP code is written in a low-key way, but it is easy to realize log, interceptor, filter and other functions
  • MVC, API, websocket, microservice and other systems are constructed fastest, good and most fiercely
  • The configuration is greater than the code, and priority is given to automatically implement five methods, such as adding, deleting, modifying and querying, and pagination, to facilitate the establishment of authority background system
  • With the field level RBAC and pluggable middleware decorator, the assembly function has unlimited possibilities
  • Support for serverless, the introduction of router in the controller method, you can easily change the background page, or even write to a file
  • Multiple databases are allowed, as long as it is a relational database allowed by typeorm. Currently, MySQL and Postgres have been provided
  • Add the example directory of socketio demo[the default is management Version (the default password of Redis is 6543210)]
  • Method override can be used to replace the curdp method generated automatically, so that there is no need to worry about whether there is redundancy in the routing
  • From the ES6 magic function generator generator, plus the whole asynchronous to further improve efficiency, so stable, extremely fast

ThinkTs

Thinkts refers to the implementation of [ThinkPHP + Nestjs + SpringBoot + FastAPI]. Of course, the purpose is also for product managers. The idea is that it is possible to achieve a small goal (project) every day…

Benchmarks🚀

With ThinkTs your controller look like this:

@Class(["add","del","fix","info","page"])//or @Class("/admin",……)or @Class("admin",……)
class Admin extends Controller{
  @Inject(Admin$) readonly a_:Admin$
  @Inject(User$) readonly u_:User$

  @Middle(W.Log,W.V_B("account|1#3~10","pwd#6~23|1"))
  @app.post("register")
  add(@B b,@R r:Response) {
    r.status=202;//Set status code
    return this.u_.register(b.account,b.pwd)
  }
}
/** Here's how to show EJS template rendering */
class View{
  @Get() @Get("index.html")
  index(ctx:Context){
    html(ctx,{test:"test",author:"asciphx"}).next().value
  }
  @Get("login.html")
  login(ctx:Context){
    html(ctx,{test:"test",author:"Login"}).next().value
  }
}

And your service looks like this:

export default class User$ extends $ implements F{
  constructor(
    private u=Inject(User),private r=Inject(Role)
  ) {
    super({
      leftJoin:{e:"u.roles",a:'role'},
      addSelect:['role.id','role.name'],
      where: query => new Brackets(qb => {
        if (query.account) qb.where('account like :v', { v: `%${query.account}%` })
        if (query.id) qb.andWhere('u.id >:i', { i: query.id })
      }),
      orderBy: { "u.id": "desc" }
    },"u")
  }
}

And your interface looks like this:

export default interface UserFace{
  /** register one*/register(entity)
  /** login one*/login(entity)
}