File tree Expand file tree Collapse file tree
test/edgehog_web/controllers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # This file is part of Edgehog.
2+ #
3+ # Copyright 2026 SECO Mind Srl
4+ #
5+ # Licensed under the Apache License, Version 2.0 (the "License");
6+ # you may not use this file except in compliance with the License.
7+ # You may obtain a copy of the License at
8+ #
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing, software
12+ # distributed under the License is distributed on an "AS IS" BASIS,
13+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ # See the License for the specific language governing permissions and
15+ # limitations under the License.
16+ #
17+ # SPDX-License-Identifier: Apache-2.0
18+
19+ defmodule EdgehogWeb.VersionController do
20+ use EdgehogWeb , :controller
21+
22+ @ version Mix.Project . config ( ) [ :version ]
23+
24+ def show ( conn , _params ) do
25+ json ( conn , % { version: @ version } )
26+ end
27+ end
Original file line number Diff line number Diff line change @@ -54,6 +54,8 @@ defmodule EdgehogWeb.Router do
5454 interface: :playground ,
5555 socket: EdgehogWeb.GqlSocket
5656
57+ get "/version" , EdgehogWeb.VersionController , :show
58+
5759 scope "/tenants/:tenant_slug" do
5860 scope "/api" do
5961 pipe_through :api
Original file line number Diff line number Diff line change 1+ # This file is part of Edgehog.
2+ #
3+ # Copyright 2026 SECO Mind Srl
4+ #
5+ # Licensed under the Apache License, Version 2.0 (the "License");
6+ # you may not use this file except in compliance with the License.
7+ # You may obtain a copy of the License at
8+ #
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing, software
12+ # distributed under the License is distributed on an "AS IS" BASIS,
13+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ # See the License for the specific language governing permissions and
15+ # limitations under the License.
16+ #
17+ # SPDX-License-Identifier: Apache-2.0
18+
19+ defmodule EdgehogWeb.Controllers.VersionControllerTest do
20+ use EdgehogWeb.ConnCase , async: true
21+
22+ @ version Mix.Project . config ( ) [ :version ]
23+
24+ test "returns the application version" , % { conn: conn } do
25+ conn = get ( conn , "/version" )
26+
27+ assert % { "version" => version } = json_response ( conn , 200 )
28+ assert version == @ version
29+ end
30+ end
You can’t perform that action at this time.
0 commit comments