summaryrefslogtreecommitdiffstats
path: root/src/Config.elm
diff options
context:
space:
mode:
authorJan Tuomi <jan.tuomi@valuemotive.com>2021-10-29 15:22:52 +0300
committerJan Tuomi <jan.tuomi@valuemotive.com>2021-10-29 15:22:52 +0300
commita972058d20b773f4488df51babb40156c5a335e1 (patch)
tree80b8e18462134da7e5d00a2a32fc25bfd5855667 /src/Config.elm
parentf4dacee4908300f63200864b9f089874152a568c (diff)
Add feed
Diffstat (limited to 'src/Config.elm')
-rw-r--r--src/Config.elm23
1 files changed, 23 insertions, 0 deletions
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