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

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.

主站蜘蛛池模板: 明光市| 罗定市| 海宁市| 于田县| 井研县| 青神县| 博罗县| 东乌珠穆沁旗| 双鸭山市| 瓮安县| 新泰市| 化隆| 陇南市| 陇川县| 北辰区| 德令哈市| 深圳市| 平利县| 凤台县| 枝江市| 鄯善县| 霍林郭勒市| 阳东县| 毕节市| 综艺| 长宁县| 蓬安县| 邛崃市| 武宣县| 南康市| 平凉市| 社会| 肇源县| 江陵县| 连城县| 木兰县| 房产| 潼南县| 龙陵县| 萨迦县| 海丰县|