trying to get "post json data via api" to work - going nowhere! basic questions:
>the URL i am sending the json data to - what should that page do when it is called?
>what should be on that page? how do i get data there, then calculate using my class, then return the data?
>i feel lost regarding API's. people post things that seem in the middle of the process. please explain it from the ground up. for hours i view posts that do not really cut to the essence of everything that is going on.
>i already have an index.html that sets up an array, then instantiates my Calculate class that has methods for Mean, Median, Mode, and Range - that works fine. BUT,
>how do i "make it available via an API", and provide the input as JSON, and then output a JSON format?
A more complete explanation is here: "Your client has asked you to make this library available via an API. Your API should implement a single endpoint called "/mmmr" with no query
string parameters. When a POST request is called to "/mmmr", a single JSON object will be passed with an attribute called "numbers". "numbers" is a JSON array of n numbers that should be processed. The script should process the mean, median, mode and range of the numbers and return back a JSON object."
Sample JSON POST body to [single endpoint] /mmmr
5, 6, 8, 7, 5
Sample JSON Return Response from /mmmr