Phoenix Web Development
Brandon Richey更新时间:2021-08-27 18:28:58
最新章节:Leave a review - let other readers know what you think封面
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
Summary
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
Summary
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
Summary
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
Restricting access via sessions
Working with validations and errors
Making usernames unique
Writing custom validations
Displaying validation errors in our forms
Summary
Live Voting with Phoenix
Building channels and topics in Phoenix
Understanding sockets
Understanding channels
Working with ES2015 syntax
Imports and exports
let and const
Fat-arrow functions
Variable and argument destructuring
Sending and receiving messages with channels
Conditionally loading our socket
Sending messages on the socket
Allowing users to vote on polls
Making voting real-time
Building our dummy functionality
Changing our dummy code to push to the server
Writing our server channel code for live voting
Refactoring our channels away from the index
Moving the channel functionality to show
Starting our channel tests
Summary
Improving Our Application and Adding Features
Designing and implementing our new features
Implementing file uploads in Phoenix
Working with uploads in Phoenix
Adding file uploads to our new poll UI
Hooking up the uploads to our database
Writing the migration file
Modifying the schema and the context code
Completing the votes context for the image uploads
Implementing voting restrictions
Creating the vote record migration
Creating the vote record schema
Hooking up restrictions
Fixing the broken tests
Summary
Adding Chat to Your Phoenix Application
Adding chat to a Phoenix application
Working with the chat schema
Building the chat schema
Designing our message functionality
Implementing message functions in our context
Writing our unit tests
Fixing navigation in our application
Creating the chat UI
Building the UI Itself
Creating our chat channel
Sending chat messages
Hooking up the new JavaScript code to Phoenix
Refactoring for poll chats
Fixing up our tests
Returning to a passing test suite
Summary
Using Presence and ETS in Phoenix
Utilizing Presence and ETS to make our app more robust
What is Presence?
Updating our chat UI
Elixir implementation
JavaScript implementation
Using ETS
Why use ETS?
Experimenting with ETS in an IEx window
Creating our Presence ETS table and GenServer
Setting up the GenServer
Creating the public interface for the GenServer
Implementing the cast and call logic
Hooking up the GenServer to our application
Storing Presence data in ETS
Retrieving Presence data in ETS
Summary
Working with Elixir's Concurrency Model
Introduction to Elixir's concurrency model
The difference between concurrency and parallelism
In process 1
Run process 1
In process 1
In process 2
Run process 1 and process 2 at the same time
Talking about OTP/understanding the model
Working with an example
Diving deeper into the concurrency model
The model - what is a process?
The model - what if our process crashes?
The model - what is a task?
The model - what is an agent?
The model - what is a supervisor?
The model - what is an application?
Using GenServers
Summary
Implementing OAuth in Our Application
Solidifying the new user experience
Shoring up our tests
Building a good development seeds file
Hooking up our polls index
Adding Ueberauth support
Adding OAuth login support for Twitter with Ueberauth
Setting up our application with Twitter
Configuring the Twitter login process in Phoenix
Modifying the users schema
Implementing the Twitter login in Phoenix
Adding OAuth login support for Google with Ueberauth
Configuring Google to allow OAuth
Configuring Ueberauth in Google
Implementing Google OAuth for Ueberauth and Phoenix
Summary
Building an API and Deploying
Building our API
Building an API in Code
Expanding Our API Request
Authenticating Against our API
Allowing a user to navigate to their profile page
Introducing API keys to the database
Validating API Keys
Dealing with Error Handling in APIs
Implementing an API Resource Show
Adding an Error Handler for 404s for JSON
Deploying Phoenix applications to production
Initial requirements for deployment into production
Alternative Deployment Strategies
Summary
Other Books You May Enjoy
Leave a review - let other readers know what you think
更新时间:2021-08-27 18:28:58