diff options
Diffstat (limited to 'src/Config.elm')
| -rw-r--r-- | src/Config.elm | 23 |
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 |
