更新时间:2021-07-23 20:49:53
coverpage
Elixir Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files eBooks discount offers and more
Preface
What this book covers
What you need for this book
Who this book is for
Sections
Conventions
Reader feedback
Customer support
Chapter 1. Command Line
Introduction
Using the terminal to prototype and test ideas
Loading and compiling modules
Getting help and accessing documentation within IEx
Using Erlang from Elixir
Inspecting your system in IEx
Inspecting your system with Observer
Creating a simple application
Managing dependencies
Generating a supervised application
Generating umbrella applications
Managing application configuration
Creating custom Mix tasks
Chapter 2. Data Types and Structures
Understanding immutability
Adding and subtracting lists
Combining tuples into a list
Creating and manipulating keyword lists
Using pattern matching
Pattern matching an HTTPoison response
Creating a key/value store with a map
Mapping and reducing enumerables
Generating lazy (even infinite) sequences
Streaming a file as a resource
Chapter 3. Strings and Binaries
Joining strings
Splitting strings
Replacing string codepoints with patterns
Slicing strings with ranges
Using regular expressions
Combining operations with the |> operator
Creating a word list
Determining the word frequency in a text
Reading and writing metadata from MP3 files
Chapter 4. Modules and Functions
Namespacing modules
Using module attributes as constants
Enforcing behaviors
Documenting modules
Using module directives
Using a module in the scripted mode
Defining functions with default arguments
Using guard clauses and pattern matching in function definitions
Chapter 5. Processes and Nodes
Sending messages between processes
Making code run on all available CPUs
Using tasks to perform multiple concurrent computations
Creating a stateful server process (messages with counters)
Using agents as an abstraction around states
Using an ETS table to share the state
Creating named nodes
Connecting nodes
Executing code in a different node
Chapter 6. OTP – Open Telecom Platform
Implementing a GenServer
Expanding our server
Creating a supervisor
Using Observer to inspect supervisors and processes
Handling errors and managing exceptions
Packaging and releasing an OTP application
Deploying applications and updating a running system
Chapter 7. Cowboy and Phoenix
Setting up Cowboy
Serving static files
Implementing a websocket handler
Creating a Phoenix application
Defining routes
Creating a controller
Creating views and templates
Implementing topics
Protecting the Phoenix app with SSL
Chapter 8. Interactions
Using Redis and Postgres
Using OS commands from within Elixir
Getting Twitter data
Appendix A. Installation and Further Reading
Installing Elixir
Installing PostgreSQL