In PHP frameworks such as CakePHP it is possible to auto generate the entire CRUD functionality after creating the database.
Is it possible to do this using sequelize and node js ? If so where can i find resources to do it ?
To generate models you can use sequelize-auto but you have to write code for controllers and views by yourself. I haven't found any npm package for generating boilerplate code like bake does in CakePHP.
Related
I am trying to set up a NodeJS backend with a MySQL database. I want to eventually containerize the database and containerize the backend server. To containerize the database, I need migration files.
I am looking for a framework that handles the generation of these migrations well. I have tried Sequelize, but you couldn't update your migrations based on your models.
I wanted to use AdonisJS but it was a full MVC framework, while the goal is to use it alongside Express.
Am I thinking the wrong way here?
Actually you can generate migrations from models in sequelize using sequelize-auto-migrations.
I'm trying to create an Angular2 project with a REST service, using NodeJs. Although I found some tutorials/sample codes doing this kind of applications, the organization of the code/project is different form each other. I'm trying to figure out what's the best way so far to do that.
Basically,
what is the best approach to creating Angular2 project with NodeJs back end?
what should be the folder structure?
where to put the Angular code(with TypeScript)?
how to use Bower/Gulp?
A sample of Angular2 + NodeJS and a few other things: http://thejackalofjavascript.com/developing-a-mean-app-with-angular-2-0/
You can use Angular-Cli to create the initial project structure: https://github.com/angular/angular-cli
Gulp tutorial: https://scotch.io/tutorials/automate-your-tasks-easily-with-gulp-js
I do not recommend using bower. Use npm instead, as it is more stable, and has more support from the tools.
I am facing a new project that will be probably made with sails.js. Is there any way to write 'modules' for Sails, so I can isolate specific views, controllers, models, services, etc. in a module (folder) I can add or remove easily? If not, any idea / hack to achieve this?
Thanks in advance
As we all know sails.js is built over node.js and express.js. We can write modules for node.js and then include them in our sails projects..
Here is a beautiful tutorial on how to write and publish node modules..
Is there a way to create a crud scaffold by using the schema model used?
Must not be a framework, more of a utility.
Currently using:
ExpressJS
MongooseJS
MongoDB
I guess you could try to use RailwayJS? It has an example as well for setting up a CRUD scaffold:
railway init blog && cd blog
npm install -l
railway generate crud post title content
railway server 8888
open http://127.0.0.1:8888/posts
EDIT
There are a couple of alternatives, but I think Railway is your best bet, unless I misunderstand your question. You could implement something yourself, as was already suggested. For more on these alternatives, see these StackOverflow questions (you are not the first to ask this):
Is there a CRUD generator for Mongoose and Node.js and Underscore? Or a CRUD generator for a similar stack?
CRUD module or tutorial for node.js
I created bumm, a command line tool for generating express project skeletons and scafflod models/routes/views that could fit your needs. The view generation is not exactly what you might want since bumm does not parse an existing model but expects the model fields to be passed as command line parameters. But it's open source...
I'm using MEANJS (www.meanjs.org) and it has a yeoman generator which doesn't only generate the seed app, but can generate a module for you which includes mongoose models, expressjs routes and controllers and the same for angular for a crud, but you can't specify the fields (got to code those in after the generator does the plumbing for you).
I would love to see them expand it to some generator where I can specify the fields and their type.
Assuming you already have node and npm installed
npm install -g express
npm install -g express-generator
Then use express to scaffold a webapp
express "app name"
I created a short tool for this purpose recently, CRUD scaffolder. It's not much, it has some problems, but it helped me start faster with some projects at the time.
I like these words:
Must not be a framework, more of a utility.
Have you tried amur?
It's a utility for generating koa+mongoose+graphql API resources.
I'm using node.js and backbone for a web app. Backbone is part of my package requirments. I've used Rails and Backbone before, and the helper gems are nice for piecing together all the assets (js files) that need to get to the client.
With that said, I had to manually download backbone.js and manually add it and all the other supported js libraries in the header of my app's layout file.
Should installing the backbone module get me away from that manual effort to create the required source for my client app? Is there some kind of jammit/asset pipeline?
you should simply npm install backbone in your main directory, this way all the submodules you use will find this exact backbone, and will use it
moreover, this way you can easily extend backbone with additional submodules
I use the stitch package to serve my scripts in node apps. With that, it's as simple as listing backbone.js as a dependency, and I install it with npm. That's convenient.