官术网_书友最值得收藏!

Building Controllers, Views, and Templates

This chapter is focused on the building blocks of any Phoenix application. By understanding what controllers, views, and templates are (and how they interact), it becomes much easier to build out our web application. We'll tackle this through the perspective of building the first major component of our Live Voting application, and by writing tests to cover the new functionality introduced.

The reader will become proficient in a lot of the basic tenets of using controllers, views, and templates. In addition, the reader will learn how the three pieces fit together via functional composition. Finally, they'll begin diving into writing their first tests covering controllers and views to start enforcing a strong and real-world systems development life cycle (SDLC). This will be from the perspective of building an actual application, so we'll start laying the framework for our voting app.

We've stepped through the very basics of creating a sample application and learned a little bit about the base structure of Elixir and how to use a few of the helper tools such as IEx, and also talked about what the structure of a Phoenix application will be, but now we actually need to start diving into the code itself and start understanding each of the pieces of our application. In my mind, the controllers are one of the most important pieces of a Phoenix application, as they provide that all-important bridge between what your database holds, what your schemas interpret, and what the user actually sees on their screen (whether it’s via API calls or browser requests).

主站蜘蛛池模板: 德庆县| 南漳县| 诸城市| 瑞安市| 武平县| 建湖县| 石柱| 额尔古纳市| 台湾省| 固阳县| 石棉县| 垣曲县| 马山县| 安塞县| 宜丰县| 从江县| 望奎县| 白银市| 黄大仙区| 苏尼特左旗| 金川县| 黎城县| 枝江市| 循化| 疏附县| 安岳县| 黄平县| 江达县| 昌江| 宜川县| 松潘县| 桃源县| 重庆市| 长武县| 马公市| 呼和浩特市| 齐河县| 天等县| 岑溪市| 堆龙德庆县| 建德市|