官术网_书友最值得收藏!

Reading a comment

  • Request: GET /posts/1/comment/1 HTTP/1.1 or GET /comment/1 HTTP/1.1

The second one seems more reasonable as in that one only needs to have a comment's ID without worrying about the post ID of that comment. And since a comment's ID is unique, we don't need to have the post's ID to get the comment. So, we will proceed with the second URL that is GET /comment/1 HTTP/1.1.

  • Response:
{id:1, post_id:1, comment:"An Awesome Post", link: "/comments/1"}
  • Response code: 200 OK

Since any comment can only exist against some post, the response includes post_id as well.

主站蜘蛛池模板: 建湖县| 临朐县| 贡嘎县| 尼勒克县| 武安市| 伽师县| 六盘水市| 施秉县| 封开县| 鹤壁市| 宜城市| 临漳县| 海丰县| 尚义县| 琼结县| 东阳市| 阜新市| 宁城县| 息烽县| 同江市| 万宁市| 娄烦县| 任丘市| 密山市| 博乐市| 隆化县| 庆元县| 济阳县| 丰都县| 乌苏市| 玉田县| 阿巴嘎旗| 习水县| 赤水市| 中山市| 孙吴县| 卓资县| 新绛县| 灌南县| 青田县| 荆州市|