Skip to Content
Phoenix Web Development
book

Phoenix Web Development

by Brandon Richey
April 2018
Beginner to intermediate content levelBeginner to intermediate
406 pages
9h 33m
English
Packt Publishing
Content preview from Phoenix Web Development

Creating our accounts context

We'll need to start off by creating the actual file that will be used as the primary interface for our context. We already created our lib/vocial/accounts directory, so it will be pretty easy for us to next create our context file. Let's create lib/vocial/accounts/accounts.ex and give it a basic structure:

defmodule Vocial.Accounts do  import Ecto.Query, warn: false  alias Vocial.Repo  alias Vocial.Accounts.Userend

Next, we'll need to give it some sort of starting function so that we can actually start to test that we've successfully hooked up the user schema to the accounts context and then to our application at large. We'll start simply, by creating a list_users() function that will just return a list of every ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Phoenix in Action

Phoenix in Action

Geoffrey Lessel
Real-Time Phoenix

Real-Time Phoenix

Stephen Bussey

Publisher Resources

ISBN: 9781787284197Supplemental Content