Appendix.Namespace (appendix v0.0.4)

A module for defining namespaced routes in Plug applications. This module provides macros for organizing routes under a common path, similar to Phoenix's pipelines but scoped to a specific route.

Summary

Functions

Defines a namespace for a group of routes under the given path. The namespace macro allows you to group related routes and apply common plugs to all routes within the namespace.

Functions

Link to this macro

namespace(path, list)

(macro)

Defines a namespace for a group of routes under the given path. The namespace macro allows you to group related routes and apply common plugs to all routes within the namespace.

Parameters

  • path: The base path for the namespace (e.g., "/api").
  • do: block: The block of code containing the routes and plugs to be applied within the namespace.

Example

namespace "/api" do
  plug Plug.Logger

  get "/status" do
    send_resp(conn, 200, "API is up and running")
  end
end