Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there anything in Node.js like scaffold in Rails? [closed]

Is there any tool or framework in Node.js that allows you to create a table in the DB and generate RESTful APIs automatically like Rails?

Thanks a lot!

like image 843
user2440712 Avatar asked Jun 06 '13 02:06

user2440712


People also ask

Is node better than Rails?

Execution SpeedNode. js wins when it comes to the execution speed of online apps or websites. The apps execute faster than Ruby on Rails since the programming is not synchronized. Moreover, programming-centered events make execution faster.

Which is better Ruby on Rails or node JS?

Ruby on Rails is considered to be faster and lighter, as compared to the Node. js as here you can easily perform tasks, like the migration of database in just performing a few commands. The learning curve is partially less than with Rails.

Is node JS faster than Ruby on Rails?

Node. js performs 20 times better than Ruby on Rails. Unfortunately, with RoR it is much harder to achieve the concurrency. It doesn't completely support asynchronous code and the performance is not that high.

Does rails require Nodejs?

Most Rails applications will not require Node. js, given the new defaults. Developers can use the JavaScript bundler they prefer, as Webpack is no longer required. The same approach has been taken with CSS bundlers that rely on Node; Rails 7 files require only a compiled application.


1 Answers

I guess it depends on what you want:

  • Rails style code generation (where it generates code for you that you can modify)
  • Django style semi magic where admin forms can be derived from the fields in your table/document schema.
  • you mean generating an API for these fields in the database, ala what grape does for Ruby -- you do some configuration and translating data to JSON and transmitting it back over the wire is taken care of for you
  • You have a new project and you're looking for a framework with one of these three characteristics

For the first three options there are a few related SO questions on this already:

  • Node.js Mongoosejs Crud scaffolding

  • Admin panel for Node.js and Mongoose

  • Is there a CRUD generator for Mongoose and Node.js and Underscore? Or a CRUD generator for a similar stack?

There are a few awesome answers in this set of links, including:

  • @jsalonen's answer gathering up some tools <-- mostly about generating admin UIs
  • @Dow's answer with some tools <-- he mentions RailwayJS (now CompoundJS), then points to some other SO questions/answers on this topic.
  • @bergie's answer about a module that exposes JugglingORM models as RESTful API routes automatically
  • Or, as @Andbdrew mentioned in the comments, there's node-restify
  • You could write your own generator - perhaps you could write a Cake task that would take a template file, execute some Javascript and output a view for your application. I started down this path recently myself. Certainly with the variety of technologies Node.js apps involve (different ORM choices, Javascript front ends, CSS layouts) this may make sense.

For the last option - an opinionated rapid web development Node.js framework that provides good API support, there are a few options:

  • @abject_error's answer, in this question, about Sails
  • Geddy <-- automatically provides .json versions of the data your controller specifies (depending on the request it uses this data to render HTML views or creates a JSON representation)
  • There's a nice slide-show on How to quickly make REST APIs with CompoundJS, so CompoundJs may fit your tastes.

I initially left these off as I assumed you may have an existing project, or didn't want to use an opinionated framework, but added them because why not.

like image 114
RyanWilcox Avatar answered Sep 18 '22 17:09

RyanWilcox