http_router alternatives and similar packages
Based on the "Framework Components" category.
Alternatively, view http_router alternatives based on common mentions on social networks and blogs.
-
ex_admin
ExAdmin is an auto administration package for Elixir and the Phoenix Framework -
phoenix_html
Phoenix.HTML functions for working with HTML strings and templates -
phoenix_ecto
Phoenix and Ecto integration with support for concurrent acceptance testing -
absinthe_plug
Plug support for Absinthe, the GraphQL toolkit for Elixir -
react_phoenix
Make rendering React.js components in Phoenix easy -
phoenix_live_reload
Provides live-reload functionality for Phoenix -
params
Easy parameters validation/casting with Ecto.Schema, akin to Rails' strong parameters. -
phoenix_pubsub_redis
The Redis PubSub adapter for the Phoenix framework -
dayron
A repository `similar` to Ecto.Repo that maps to an underlying http client, sending requests to an external rest api instead of a database -
rummage_phoenix
Full Phoenix Support for Rummage. It can be used for searching, sorting and paginating collections in phoenix. -
phoenix_token_auth
Token authentication solution for Phoenix. Useful for APIs for e.g. single page apps. -
sentinel
DEPRECATED - Phoenix Authentication library that wraps Guardian for extra functionality -
phx_component_helpers
Extensible Phoenix liveview components, without boilerplate -
plug_rails_cookie_session_store
Rails compatible Plug session store -
filterable
Filtering from incoming params in Elixir/Ecto/Phoenix with easy to use DSL. -
multiverse
Elixir package that allows to add compatibility layers via API gateways. -
access pass
provides a full user authentication experience for an API. Includes login,logout,register,forgot password, forgot username, confirmation email and all that other good stuff. Includes plug for checking for authenticated users and macro for generating the required routes. -
better_params
Cleaner request parameters in Elixir web applications ๐ -
scrivener_headers
Scrivener pagination with headers and web linking -
phoenix_pubsub_rabbitmq
RabbitMQ adapter for Phoenix's PubSub layer -
plug_checkup
PlugCheckup provides a Plug for adding simple health checks to your app -
plug_rest
REST behaviour and Plug router for hypermedia web applications in Elixir -
Votex
Implements vote / like / follow functionality for Ecto models in Elixir. Inspired from Acts as Votable gem in Ruby on Rails -
trailing_format_plug
An elixir plug to support legacy APIs that use a rails-like trailing format: http://api.dev/resources.json -
phoenix_html_simplified_helpers
Some helpers for phoenix html( truncate, time_ago_in_words, number_with_delimiter, url_for, current_page? )
Learn Elixir in as little as 12 Weeks
Do you think we are missing an alternative of http_router or a related project?
README
HttpRouter
HTTP Router with various macros to assist in developing your application and organizing your code
Installation
Add the following line to your dependency list
in your mix.exs
file, and run mix deps.get
:
{:http_router, "~> 0.0.1"}
Also, be sure to add :http_router
to the list
of applications on which your web application
depends (the default looks something like
applications: [:logger]
) in your mix.exs
file.
Be sure to have Plug in your dependency
list as well as this is essentially a
reimagination of the Plug.Router
module, and
as such, it still make use of a large portion
of the Plug library.
Usage
To get the benefits that this package has to
offer, it is necessary to use the HttpRouter
module in one of your modules that you wish to
act as the router for your web application.
Similar to Plug.Router
, we can start with a
simple module:
defmodule MyRouter do
use HttpRouter
end
That was easy, huh? Now, this module still needs a few calls to the below macros, but this depends on how your application needs to be structured.
The Macros
Check out this convoluted example:
defmodule MyRouter do
use HttpRouter
# Define one of the versions of the API
# with a simple version number "1"
# or following semver "1.0.0"
# or date of release "2014-09-06"
version "1" do
# Define your routes here
get "/", Handlers.V1.Pages, :index
get "/pages", Handlers.V1.Pages, :create
post "/pages", Handlers.V1.Pages, :create
put "/pages/:page_id" when id == 1,
Handlers.V1.Pages, :update_only_one
get "/pages/:page_id", Handlers.V1.Pages, :show
# Auto-create a full set of routes for resources
#
resource :users, Handlers.V1.User, arg: :user_id
#
# Generates:
#
# get "/users", Handlers.V1.User, :index
# post "/users", Handlers.V1.User, :create
# get "/users/:user_id", Handlers.V1.User, :show
# put "/users/:user_id", Handlers.V1.User, :update
# patch "/users/:user_id", Handlers.V1.User, :patch
# delete "/users/:user_id", Handlers.V1.User, :delete
#
# options "/users", "HEAD,GET,POST"
# options "/users/:_user_id", "HEAD,GET,PUT,PATCH,DELETE"
end
# An updated version of the AP
version "2" do
get "/", Handlers.V2.Pages, :index
post "/pages", Handlers.V2.Pages, :create
get "/pages/:page_id", Handlers.V2.Pages, :show
put "/pages/:page_id", Handlers.V2.Pages, :update
raw :trace, "/trace", Handlers.V2.Tracer, :trace
resource :users, Handlers.V2.User
resource :groups, Handlers.V2.Group
end
end
get/3
, post/3
, put/3
, patch/3
, delete/3
,
options/2
, and any/3
are already built-in as
described. resource
exists but will need
modifications to create everything as noted.
raw/4
allows for using custom HTTP methods, allowing
your application to be HTTP spec compliant.
version/2
will need to be created outright. Will
allow requests to contained endpoints when version
exists in either Accepts
header or URL (which ever
is defined in app config).
Extra routes will need to be added for *.json
,
*.xml
, etc. requests for optionally specifying
desired content type without the use of the
Accepts
header. These should match
parsing/rendering abilities of your application.
Configuration
TBD.
License
HttpRouter is released under the MIT License.
See [LICENSE](license) for details.
*Note that all licence references and agreements mentioned in the http_router README section above
are relevant to that project's source code only.