Building an Action

The first thing we’ll need is a simple way to list all the menu items that we have in our system so that we can then take further action upon them. If you aren’t super familiar with doing server-side rendering with Phoenix, don’t worry; we’ll cover everything you need to know here. In order to avoid writing a ton of HTML boilerplate, we’ll use one of the Phoenix generators and then we’ll replace the generated controller contents as needed. Run this in your shell:

​ ​$ ​​mix​​ ​​phx.gen.html​​ ​​--no-context​​ ​​--no-schema​​ ​​Menu​​ ​​Item​​ ​​items​
​ ​$ ​​rm​​ ​​test/plate_slate_web/controllers/item_controller_test.exs​

The first command ...

Get Craft GraphQL APIs in Elixir with Absinthe now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.