Can elm accept incoming post data

if there is post data coming from other site, can elm accept it?

To clarify your question, which of the following are you asking:

  1. If an Elm program makes a POST request to a server, can it handle the response?
  2. Is it possible for another program to make a POST request to an Elm program?

The answer to the first question is yes. The core Http.post function allows you to pass in a JSON decoder that will process the POST response (in JSON) into Elm types. For a more custom setup you may need to use Http.request.

For the second question, the answer is no. Receiving a POST request can only be done by an HTTP server. Elm apps run in a web browser and browsers don’t allow you to receive HTTP requests.

If you’re new to web development, you may enjoy this article on the differences between client and server side development. :slightly_smiling_face:

3 Likes

I am asking the 2nd question. Thank you, I am clear now

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.