更新时间:2021-08-27 18:28:58
封面
Title Page
Copyright and Credits
Phoenix Web Development
Packt Upsell
Why subscribe?
PacktPub.com
Contributors
About the author
About the reviewers
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Get in touch
Reviews
A Brief Introduction to Elixir and Phoenix
Introducing IEx and Elixir
What is IEx?
Variables in Elixir
Immutability in Elixir
Understanding the different types in Elixir
Getting more information with the i helper
Getting more information with the h helper
Using IEx and helpers to understand types
Your objects have no power here
Introduction to Phoenix
Installing Phoenix 1.3
Creating a new Phoenix project
Running the Phoenix Mix Task
Running the Phoenix server for the first time
Phoenix's default application structure
Configuration files
Assets files
Private files
Tests
Other directories
The most important directory: lib
A note about how data flows in Phoenix
Summary
Building Controllers Views and Templates
Understanding the flow of Phoenix connections
Creating our Social Voting project
Creating a poll controller
Understanding the controller's structure
Building the poll controller
Understanding templates
Passing data to our templates
Writing controller tests
Understanding the code behind tests
Writing the poll controller test
Storing and Retrieving Vote Data with Ecto Pages
Understanding the role of schemas
Creating a new migration
Creating the Polls table migration
Creating our Options table migration
Creating our Poll schema
Testing our Poll schema
Creating our Option schema
Understanding the gotchas of associations
Understanding the role of contexts
Creating a Votes context
Grabbing a list of data
Understanding Ecto query writing
Hooking up the context to our controller
Creating a new poll
Creating the new action in the controller
Creating our create function
Writing our unit tests
Introducing User Accounts and Sessions
Adding user accounts
Designing our user schema
Creating our user schema
Creating our accounts context
Writing our user unit tests
Creating a user signup page
Creating the routes
Creating the controller code (with tests)
Setting up the password functionality
Installing Comeonin
Adding Comeonin to the user schema file
Updating our tests
Updating the UI to include password fields
Creating a user login page
Building our create session function
Writing session controller tests
Validations Errors and Tying Loose Ends
Connecting polls to users
Creating the migration
Modifying the schemas
Fixing broken poll tests
Sending a user ID through the controller
Retrieving data from sessions
Writing our Poll Controller's tests