Node.js Mongoosejs Crud scaffolding - node.js

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.

Related

Autogenerate CRUDs using sequelize and node js

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.

Angular2 and NodeJs

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.

Sails.js API documentation

I want to develop an API using the MVC pattern. I found sails framework interesting and I'd like to know if it's possible to configure swagger or something like with sails to generate the documentation of my API (something like swagger-express for express for example).
Thanks!
This feature is in progress. If you'd like to help out, we can all collaborate here: https://github.com/balderdashy/sails/issues/1094
Update (August 2015):
Check out this Sails Hook that offers native Swagger integration. It compiles all of the bound routes in Sails, and generates a Swagger 2.0 document: https://github.com/tjwebb/sails-swagger
Here is what I did to have my documentation work with sails.js : you can download swagger-ui here : https://github.com/swagger-api/swagger-ui or via npm (npm install swagger-ui).
Then in the assets folder of your sails project, create a folder that points to the swagger folder ("docs" for example, so you'll be able to access to your documentation via your_url:port/docs)

Yeoman and ExpressJS

I want to know if there is some boilerplate code to use a frontend workflow tool like Yeoman with a backend framework like ExpressJS, if I want to maintain the same codebase for both the front and back ends.
Basically I want to know -
How do the boilerplate code produced by yeoman and express fit in together. Is there a way to integrate the two? (How does the gruntfile fit into the express project)
Can I substitute yeoman's default watch with an express server which reloads pages on update?
Yeoman is currently focused on front-end app development, but we're going to explore back-end integration in the future.
No, actually there isn't any right now.
But you can combine express.js with the component package manager. There is some work left, and you cant use yeoman components in component.
To answer your questions
You can look for components in the component repo that you have used in yeoman. Not the same, but might be a solution.
Use the module supervisor for this. You can get it via npm
I haven't found an easy way of integrating my own Express + H5BP + Angular + Grunt skeletons into Yeoman, and eventually just settled for creating a repo here: https://github.com/ericclemmons/genesis-skeleton
From what I've read, there are projects underway to add express generators, but eventually stacks are going to get complex enough to where you'll have to maintain your own starter app, rather than generating it.
There's an experimental branch with yeoman + express.js G+ Yeoman/Express Article
I found yeoman.js to be very cool for rapid prototyping but does require some ramping up to get used to the various tools it's "opinionated" about. I've decided to go over each of the core tools in some vids that are hopefully helpful: yeoman.js related videos
Yoeman fullstack generator now generates both front end and back end. Other interesting frameworks which do the same are Sails JS and StrongLoop
It is worth noting there is an express-generator project:
official docs
npm page
I am going to give it a go - because I'm folling this tutorial - but other than that I cant comment on its value.

What are the Express.js equivalent of Rails Gems?

Is there some kind of equivalent of Rails "Gems" for express.js? Specifically I'm fishing around for something that can read in RSS feeds efficiently, including the ability to accept poorly formed XML files, but my real question is: where do I even get started looking? (or is Express.js too young to have an extension library?)
A lot of people compare express to ROR, but should, as the author also does compare it to sinatra instead of ROR.
Sinatra is a DSL for quickly creating
web applications in Ruby with minimal
effort
If you haven't already installed npm(probably have to install express?) you should. I think you can compare npm to gem. When searching for rss via http://search.npmjs.org I found the following package which could be useful:
http://search.npmjs.org/#/easyrss
Where to start looking:
http://search.npmjs.org/ rss
https://github.com/ node rss
http://google.com node.js rss
Express.js has modules that can act as middleware to express/connect. Modules such as everyauth and session (which is already bundled with connect) add additional functionality to Express and Connect. Express is built on top of Connect.
Several great modules already included into Connect
A quick primer on how Express uses middleware.
I'm not sure about Express specifically, but I know about Node.js npm command that lets you install Node packages.
Alfred's answer is very good, I just want to point out that you shouldn't think of "Express Gems" just like you shouldn't think of "Rails Gems", but instead think of "Node.js Gems" and "Ruby Gems".
You can compare Ruby with Node (as they are both languages), Sinatra (and perhaps Rails, but not 100%) with Express.js.
So there are packages for Node.js which you can install with npm. Express.js is such a package ("gem"). For more packages search npm
If you are interested in Express.js middleware, look here on the Express wiki page

Resources