3

I want to write my own scaffold generator for Express Framework. I do realize that there are frameworks that do that, but I want to write my own. I'd like the functionality to be similar to Rails.

For example:

generate model user name:String email:String

should create user.js in the models directory, with the two specified fields in the schema.

I also want to generate the controller for the model, with the crud operations using the db connector:

generate controller users mongoose

should create users.js in the controllers directory and should contain the crud operations based on mongoose api.

How do I go about doing the same?

PS: The back end is a REST API for an IOS app, so I'm not interested in generating views.

J. Steen
  • 15,470
  • 15
  • 56
  • 63
tldr
  • 11,924
  • 15
  • 75
  • 120

2 Answers2

2

If you want MVC framework in node js with generator functionalities then my prefer

CompoundJS

also routes and syntax are more similar to ruby on rails

You can also do CRUD through it by compound generate crud post title content

for controller compound g controller controllername actionName anotherActionName

for Model compound g model user name password createdAt:date activated:boolean

For Scaffold compound g scaffold post title content createdAt:date

Thanks

Rajarshi Das
  • 11,778
  • 6
  • 46
  • 74
0

if you want a scaffolding tool with full model & API & resource support. You can try this tool:

Amur

With amur, you can create a full-fledged backend server with your complex app logic and running API in less than 3 minutes.

Amur automate backend coding process.

However, it creates graphQL style API, if you can accept that.

Zhang Kai Yu
  • 362
  • 2
  • 8