Friday, June 19, 2015

Finally starting to understand MVC

This node.js MEAN stack tutorial just might have been the best web development tutorial I've gone through:
http://www.bradoncode.com/tutorials/learn-mean-stack-tutorial/

I've gone through the django polls one as well as part of an RoR tutorial, but either those weren't as clear or (more likely) I was too dumb and needed it see it explained several times in different ways, this MEAN stack tutorial made a lot of sense.

On the server side:

  • Model (*.model.js) = the database
  • Controller (*controller.js) = has all the CRUD calls (create, retrieve, update, delete...)
  • View? (*routes.js) = handles the REST calls from the client (web browser) and calls the appropriate functions in controller.js


Admittedly, I have no idea where the V(view) is supposed to be. I guess that's the routes.js? And I also don't know why the whole thing works javascript wise (e.g. the functions are written very smartly, in a way I'm not used to writing them). Guess I still have no idea what's going on :(


And the difference between REST and CRUD is explained very well here:
http://programmers.stackexchange.com/questions/120716/difference-between-rest-and-crud

No comments:

Post a Comment