How can I create a RESTful calculator?

后端 未结 4 1130
粉色の甜心
粉色の甜心 2021-02-01 03:32

Given that RESTful web services are all based around the sacred idea that \"everything is represented as resources and can be accessed by an address (URI)\", this may make sense

4条回答
  •  名媛妹妹
    2021-02-01 04:18

    This is a good example of the tension between nouns and verbs in REST. The suggestion to use "add" or "adder" as the resource is tremendously naïve. It implies that each operation be performed separately as a GET to an "adder" or "subtractor". Of course, one can have the resource be "calculate" but then we're using a verb. We can change it to "calculator" or "answer", which are nouns but we really haven't done anything useful.

提交回复
热议问题