diff options
author | Pierre de Lacroix <pierre@pdelacroix.com> | 2020-12-01 13:08:29 +0000 |
---|---|---|
committer | Pierre de Lacroix <pierre@pdelacroix.com> | 2020-12-01 13:08:29 +0000 |
commit | 8a05e93e1a660cc0707430cbff811fafc7716340 (patch) | |
tree | 2656048c6d4eb0ea134779a85bb6bd41a1466207 /lib/matrix_app_service_web/router.ex | |
parent | Update README.md (diff) |
add endpoint handled by the library
Diffstat (limited to 'lib/matrix_app_service_web/router.ex')
-rw-r--r-- | lib/matrix_app_service_web/router.ex | 39 |
1 files changed, 7 insertions, 32 deletions
diff --git a/lib/matrix_app_service_web/router.ex b/lib/matrix_app_service_web/router.ex index 2c2f0ca..f254bdc 100644 --- a/lib/matrix_app_service_web/router.ex +++ b/lib/matrix_app_service_web/router.ex @@ -1,36 +1,11 @@ defmodule MatrixAppServiceWeb.Router do - @moduledoc """ - Provides the Matrix Application Service API routes. + use Phoenix.Router + use MatrixAppServiceWeb.Routes - https://matrix.org/docs/spec/application_service/r0.1.2 - """ + import Plug.Conn + import Phoenix.Controller - @doc """ - This macro injects the API routes in a Phoenix router. - """ - defmacro routes() do - quote do - pipeline :matrix_api do - plug :accepts, ["json"] - plug MatrixAppServiceWeb.AuthPlug - end - - path = Application.compile_env(:matrix_app_service, :path, "/") - - scope path, MatrixAppServiceWeb.V1, as: :matrix do - pipe_through :matrix_api - - put "/transactions/:txn_id", TransactionController, :push - - get "/users/:user_id", UserController, :query - get "/rooms/:room_alias", RoomController, :query - - get "/thirdparty/protocol/:protocol", ThirdPartyController, :query_protocol - get "/thirdparty/user/:protocol", ThirdPartyController, :query_users - get "/thirdparty/location/:protocol", ThirdPartyController, :query_locations - get "/thirdparty/location", ThirdPartyController, :query_location_by_alias - get "/thirdparty/user", ThirdPartyController, :query_user_by_id - end - end - end + # if MatrixAppService.Application.start_endpoint?() do + MatrixAppServiceWeb.Routes.routes(:no_config) + # end end |