Elixirschool: Plug lesson is out of date

Created on 10 Nov 2018  Â·  3Comments  Â·  Source: elixirschool/elixirschool

The plug lesson uses outdate plug and cowboy versions:

[
    {:cowboy, "~> 1.1.2"},
    {:plug, "~> 1.3.4"}
  ]

Cowboy is now at 2.50 and Plug is at 1.7.1. Two changes I'd like to see:

  • Instead of requiring cowboy + plug separately, it is now recommended to require plug_cowboy
  • Instead of calling on Plug.Adapters.Cowboy, it is recommended to use plug_cowboy's Plug.Cowboy

From the Plug 1.7 docs:

Plug.Adapters.Cowboy
This module is deprecated. To use Cowboy 1 With Plug please include plug_cowboy version 1.0 or above in your mix.exs file. It is recommended that you use the Plug.Cowboy module directly instead of Plug.Adapters.Cowboy.

So this:

children = [
      Plug.Adapters.Cowboy.child_spec(:http, Example.Router, [], port: port)
    ]

Becomes this:

children = [
  {Plug.Cowboy, scheme: :http, plug: Example.Router, options: [port: port]}
]
bug

Most helpful comment

Hey @doomspork, I'm down to take a stab at it. I should have something for you guys in the next few days 🚀

All 3 comments

Howdy @SophieDeBenedetto! Good catch. I'd be happy to make this change and take a peek at whether the lesson needs any additional updates or you can take a stab at it — your call!

Hey @doomspork, I'm down to take a stab at it. I should have something for you guys in the next few days 🚀

You're awesome — thank you @SophieDeBenedetto!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brain-geek picture brain-geek  Â·  4Comments

doomspork picture doomspork  Â·  4Comments

gemantzu picture gemantzu  Â·  4Comments

eksperimental picture eksperimental  Â·  4Comments

jaytheking picture jaytheking  Â·  3Comments