plug
mint
Our great sponsors
plug | mint | |
---|---|---|
6 | 3 | |
2,755 | 1,328 | |
0.4% | 1.2% | |
7.7 | 6.9 | |
7 days ago | 6 days ago | |
Elixir | Elixir | |
Apache License 2.0 | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
plug
-
Elixir for Cynical Curmudgeons
Yes, it’s a bit of a magic argument, but it’s the only unhygienic variable introduced with a Plug dispatch:
https://github.com/elixir-plug/plug/blob/main/lib/plug/route...
Everything else is explicitly passed, AFAICT.
-
I'm struggling with creating a rest api with Elixir - total noob
Have you read https://github.com/elixir-plug/plug ? Shows you how to do a GET in under 5 mins.
- ElixirのHTTPクライアントでお天気情報を取得したい(2022年)
-
Request Coalescing in Async Rust
Coming from the Ruby ecosystem, a lot of this played out similarly to how the Rack[1] middleware conventions developed in the early Rails v1 and v2 days. Prior to Rack there was a lot of fragmentation in HTTP server libraries, post-Rack everything more or less played nicely as long as libraries implemented Rack interfaces.
I don't write Rust professionally, but it was a bummer seeing that this seems to be a place that was figured out (painfully) in ecosystems used heavily for web development--Javascript and Elixir have their own Rack equivalents[2][3]. I hope that Tower plays a similar role to unify the library ecosystem in Rust.
1. https://github.com/rack/rack
2. http://expressjs.com/en/guide/writing-middleware.html
3. https://github.com/elixir-plug/plug
-
Learn how to deploy Elixir apps on Heroku
If you're not familiar with it, feel free to check the inner workings of Plug in their documentation. For now, the code above is fairly self-explanatory I hope. All we need to know is that we're using the Plug.Router capabilities and exposing an endpoint /bpi which we're going to use to retrieve our data and to show it.
-
For Web Developers The Stakes Are Generally Lower
Well if Phoenix came with the ability to use Sqlite I'd definitely like it a lot better for smaller sites. Maybe if Elixir had something like Sinatra. I guess using Cowboy or Plug could work.
mint
-
Unpacking Elixir: Resilience
One example is HTTP libraries.
For instance, take Mint (https://github.com/elixir-mint/mint):
> Mint is different from most Erlang and Elixir HTTP clients because it provides a process-less architecture.
Mint is a low-level library which doesn't make attempt to manage processes (including HTTP pooling).
In contrast, Finch (which builds on top of Mint) includes pool management:
https://github.com/elixir-mint/mint#connection-management-an...
It can take someone a bit off guard when they realise that the library they use provide a "default pool" they were not aware of, and that it can become a bottleneck etc.
-
How to implement a disk cache plugin for Elixir's Req HTTP client?
> no error checking at all
Functions that raise always end in `!` in Elixir, or at least they should. Most have alternatives that return error tuples instead which you can pattern match on (this is what I recommend). You can read the docs for `get/2` (as opposed to `get!/2` which raises) here: https://hexdocs.pm/req/Req.html#get/2.
A common pattern is for the `!` version to call the version that doesn't raise, check the result, and raise on error, which is the case here: https://github.com/wojtekmach/req/blob/9de30de0df481ee557ccc...
> and if "body" is JSON, how do you even get the raw body, or can you?
You would set `decode: false` when calling `get!/2: https://hexdocs.pm/req/Req.html#new/1. You can also set this as configuration with https://hexdocs.pm/req/Req.html#default_options/1.
As a closing note I'll mention that Req is intended to be a very high-level, scripting-friendly requests library, similar to Requests in Python. If you don't want conveniences like Req provides, you can either turn them off or use something different, like Finch (which Req is based on, https://github.com/sneako/finch). Other than Req and Finch I'm personally only familiar with HTTPoison, which is significantly older than all of the libraries derived from Mint (like Finch and Req, https://github.com/elixir-mint/mint) but still works. There are many others though, like Gun and Tesla and such.
- ElixirのHTTPクライアントでお天気情報を取得したい(2022年)
What are some alternatives?
ex_admin - ExAdmin is an auto administration package for Elixir and the Phoenix Framework
finch - Elixir HTTP client, focused on performance
phoenix_ecto - Phoenix and Ecto integration with support for concurrent acceptance testing
gun - HTTP/1.1, HTTP/2, Websocket client (and more) for Erlang/OTP.
Raxx - Interface for HTTP webservers, frameworks and clients
Crawly - Crawly, a high-level web crawling & scraping framework for Elixir.
phoenix_pubsub_redis - The Redis PubSub adapter for the Phoenix framework
http_proxy - http proxy with Elixir. wait request with multi port and forward to each URIs
corsica - Elixir library for dealing with CORS requests. 🏖
lhttpc - What used to be here -- this is a backwards-compat user and repo m(
phoenix_live_reload - Provides live-reload functionality for Phoenix
ivar - Ivar is an adapter based HTTP client that provides the ability to build composable HTTP requests.