万本电子书0元读

万本电子书0元读

顶部广告

Phoenix Web Development电子书

售       价:¥

2人正在读 | 0人评论 9.8

作       者:Brandon Richey

出  版  社:Packt Publishing

出版时间:2018-04-30

字       数:52.4万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
Learn to build a high-performance functional prototype of a voting web application from scratch using Elixir and Phoenix About This Book ? Build a strong foundation in Functional-Programming techniques while learning to build compelling web applications ? Understand the Elixir Concurrency and parallelization model to build high-performing blazingly fast applications ? Learn to test, debug and deploy your web applications using Phoenix framework Who This Book Is For This book is for people with a basic knowledge of Elixir, who want to start building web applications. Prior experience with web technologies is assumed. What You Will Learn ? Learn Phoenix Framework fundamentals and v1.3's new application structure ? Build real-time applications with channels and presence ? Utilize GenServers and other OTP fundamentals to keep an application stable ? Track users as they sign in and out of chat with Phoenix’s built-in presence functionality ? Write your own database interaction code that is safe, bug-free, and easy to work with ? Explore testing and debugging methodologies to understand a real software development lifecycle for a Phoenix application ? Deploy and run your Phoenix application in production In Detail Phoenix is a modern web development framework that is used to build API’s and web applications. It is built on Elixir and runs on Erlang VM which makes it much faster than other options. With Elixir and Phoenix, you build your application the right way, ready to scale and ready for the increasing demands of real-time web applications. This book covers the basics of the Phoenix web framework, showing you how to build a community voting application, and is divided into three parts. In the first part, you will be introduced to Phoenix and Elixir and understand the core terminologies that are used to describe them. You will also learn to build controller pages, store and retrieve data, add users to your app pages and protect your database. In the second section you will be able to reinforce your knowledge of architecting real time applications in phoenix and not only debug these applications but also diagnose issues in them. In the third and final section you will have the complete understanding of deploying and running the phoenix application and should be comfortable to make your first application release By the end of this book, you'll have a strong grasp of all of the core fundamentals of the Phoenix framework, and will have built a full production-ready web application from scratch. Style and approach Covers the basics of the Phoenix web framework by building a complete real-time application and showing the new structure changes introduced in Phoenix v1.3
目录展开

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

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部