5. GET endpoints

GET /api/snippets

Return all non-private snippets together with some information about the user. Example response:

[
  {
    "id": 1,
    "created_at": "...",
    "title": "avg.js",
    "contents": "console.log('1')",
    "is_private": false,
    "user": {
      "id": 1,
      "first_name": "Orhan",
      "last_name": "Toy"
    }
  }
]

GET /api/snippets/:id

Return a single snippet. Example response:

Not found: we respond with a 404 if the snippet with the given ID cannot be found.

Last updated