Friday, December 11, 2015

Day 36

Modularization


We did some old assignments such as the Wall as one of our last assignments for the chapter. Again it was nothing too crazy and it taught us how to do what we've done before but with the MEAN stack. I finished the 1955 API a day early so it allowed me to look back and review what I've learned so far. Before 1955, we learned how to modularize our code. Therefore we separate the Node server to one file, and every Model, Controller and Routes we had into each of its own file. It's a pretty arduous process but it makes the structure of my code a lot cleaner.

The 1955 API is just a simple assignment that allows you to add and delete and look at individual names that you've added. We would first add all the necessary mongoose.js files, routes file, model file, controller file etc. Then everything that we would've had on our server file, we split. So routes has all the routes but none of the functions, that's in the controllers. Model is made to set up the Schema and table in Mongo. But yeah...that's essentially modularizing project structure!

No comments:

Post a Comment