Slide 1

Slide 1 text

INTRO TO PHOENIX ELIXIR/ERLANG MEETUP: NOVEMBER 4TH @JESSICAG

Slide 2

Slide 2 text

SET UP ▸ Assuming install of Elixir & Erlang ▸ Database installed (postgres or mysql) ▸ Install dependencies for Phoenix ▸ Phoenix Docs: http://www.phoenixframework.org/docs/ installation ▸ Let’s build! requirements and resources versions, latest vs .10 etc $ mix local.hex $ mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez

Slide 3

Slide 3 text

CREATE ▸ create db and user ▸ mix phoenix.new {project_name} ▸ to use your app for API purposes only, pass in —no-html flag ▸ edit config with db username and password ▸ mix ecto.create ▸ mix phoenix.server createdb meetup_example createuser ecto —pwprompt make sure we can login with that user psql meetup_example --user ecto explicit path vs in your directory edit with db info we use the ecto.create to compile run server

Slide 4

Slide 4 text

OUT OF THE BOX ▸ Routes ▸ mix phoenix.routes ▸ Controllers ▸ Views ▸ Tests ▸ mix test Let’s take a look at what we get with our routes, our basic gets scoped through our index and an api pipeline. First time we run our tests, we compile these files, we should see an error because we haven’t set up our test repo. createdb {db test name} remove username and password config/test.exs check out the basic test infrastructure we get, so awesome!

Slide 5

Slide 5 text

GENERATED VS MANUAL ▸ Generators take arguments for creation {Class Name} {db_table_name} {table_options} ▸ mix phoenix.gen.html ▸ mix phoenix.gen.json We can manually add controllers and actions associated, from our command line or we can use these generators and they give us a LOT

Slide 6

Slide 6 text

TESTING ▸ Ex_Machina ▸ Single Factory File ▸ https://github.com/thoughtbot/ex_machina ▸ Pry ▸ iex -S mix test ▸ require IEx && place in file IEx.pry We use ex_machina to create some factory data structures we have access to pry and allowing us to stop our server and debug

Slide 7

Slide 7 text

NEXT MEETUP… ▸ Exploring Channels ▸ Idea: ▸ Building a retro doc webpage ▸ View real-time posts from multiple users ▸ Authentication/Login ▸ Capturing posts and usernames associated