summaryrefslogtreecommitdiff
path: root/lib/matrix_app_service_web/router.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/matrix_app_service_web/router.ex')
-rw-r--r--lib/matrix_app_service_web/router.ex26
1 files changed, 23 insertions, 3 deletions
diff --git a/lib/matrix_app_service_web/router.ex b/lib/matrix_app_service_web/router.ex
index 99f4dfd..21ccc39 100644
--- a/lib/matrix_app_service_web/router.ex
+++ b/lib/matrix_app_service_web/router.ex
@@ -1,7 +1,27 @@
defmodule MatrixAppServiceWeb.Router do
- use MatrixAppServiceWeb, :router
+ defmacro routes() do
+ quote do
+ pipeline :matrix_api do
+ plug :accepts, ["json"]
+ plug MatrixAppServiceWeb.AuthPlug
+ end
- require MatrixAppService.Phoenix.Router
+ path = Application.compile_env(:matrix_app_service, :path, "/")
- MatrixAppService.Phoenix.Router.routes()
+ scope path, MatrixAppServiceWeb.V1 do
+ pipe_through :matrix_api
+
+ put "/transactions/:txn_id", TransactionController, :create
+
+ get "/users/:user_id", UserController, :show
+ get "/rooms/:room_alias", RoomController, :show
+
+ get "/thirdparty/protocol/:protocol", ThirdPartyController, :show
+ get "/thirdparty/user/:protocol", ThirdPartyController, :show
+ get "/thirdparty/location/:protocol", ThirdPartyController, :show
+ get "/thirdparty/location", ThirdPartyController, :show
+ get "/thirdparty/user", ThirdPartyController, :show
+ end
+ end
+ end
end