[solved] Please recommend a scaffolding tool based on koa mongoose

Business background

  • has recently been learning koa + mongoose to build api server
  • as a result, I feel very painful about the current operation flow
  • the current operation flow is as follows

    1. create mongoose model file model/user.js
    2. New User Database addition, deletion and query db/user.js of the model
    3. create a new controller file corresponding to this db file controller/user.js
    4. add routing files in the form of restfull router/user.js
    5. then inject the routing file into the koa-router

the root cause of distress

  • if I have ten models (datasheets)
  • then I will repeat the above action ten times
  • and the addition, deletion, modification and query of each model is the most difficult and necessary operation
  • how troublesome it is

Stone from other mountains

  • previous contact with c-sharp mvc
  • studio comes with such a scaffolding
  • you just need to define the model and automatically create database links, controllers, and even views
  • .

my question

  • is there such a scaffolding tool on node?

Don"t spray me to reach out to the Party

  • searched on Baidu, but no
  • I have also searched on
  • google, but things in pure English seem a little slow, so let"s ask a question first. It will be more efficient
  • .
  • now I"m going to google again.
Jun.04,2022

Ah, by the way. If you can recommend one by the way, it would be better to automatically generate the interface document of swagger or postman from the routing file, so you don't have to post questions separately

.

solve

  • so far (19-4-3) there seems to be no such scaffolding
  • solve it manually
  • through live template of webstorm or snippet Custom fragment of vscode
  • this repetitive work can be done in seconds

it is recommended to try Egg.js or ThinkJS , both of which are based on Koa 2.x development, and also have plug-ins connected to mongoose, and consider some common development scenarios and deal with them, I wonder if they can meet your requirements.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c15bfe-32f81.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c15bfe-32f81.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?