Skip to content

This hex package will return a map of your Phoenix application's routes.

License

Notifications You must be signed in to change notification settings

samcdavid/phoenix_route_documenter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Phoenix Route Documenter

This hex package will return a map of your Phoenix application's routes similar to the following:

%{
  paths: [
    %{
      method: "GET",
      path: "/path/to/thing/"
    },
    %{
      method: "GET",
      path: "/path/to/thing/:id"
    },
    %{
      method: "POST",
      path: "/path/to/thing/"
    },
    %{
      method: "PUT",
      path: "/path/to/thing/:id"
    },
  ]
}

This is particularly useful if you want to have an endpoint for your api that documents all of your endpoints for you automatically.

defmodule YourApp.RoutesController do
  use YourApp.Web, :controller

  alias YourApp.Router
  alias PhoenixRouteDocumenter.Endpoints

  def index(conn, _params) do
    endpoints = Endpoints.listing(Router)

    conn
    |> json(endpoints)
  end
end

Installation

The package can be installed by adding phoenix_route_documenter to your list of dependencies in mix.exs:

def deps do
  [{:phoenix_route_documenter, "~> 0.1.0"}]
end

About

This hex package will return a map of your Phoenix application's routes.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages