From a972058d20b773f4488df51babb40156c5a335e1 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Fri, 29 Oct 2021 15:22:52 +0300 Subject: Add feed --- src/Config.elm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/Config.elm (limited to 'src/Config.elm') diff --git a/src/Config.elm b/src/Config.elm new file mode 100644 index 0000000..c3df2b0 --- /dev/null +++ b/src/Config.elm @@ -0,0 +1,23 @@ +module Config exposing (ApiResource(..), makeApiUrl) + + +baseUrl : String +baseUrl = + "http://localhost:3000" + + +type ApiResource + = ApiPosts + | ApiLikePost String + + +makeApiUrl : ApiResource -> String +makeApiUrl res = + String.replace "{baseUrl}" baseUrl <| + case res of + ApiPosts -> + "{baseUrl}/posts" + + ApiLikePost postId -> + "{baseUrl}/posts/{postId}" + |> String.replace "{postId}" postId -- cgit v1.3