Skip to content

Instantly share code, notes, and snippets.

@leandroandrade
Created December 13, 2023 22:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leandroandrade/b6cb2633f1f8135b233725ff5c49a0b6 to your computer and use it in GitHub Desktop.
Save leandroandrade/b6cb2633f1f8135b233725ff5c49a0b6 to your computer and use it in GitHub Desktop.

slug

Identificador único, legível por pessoas, que permite referenciar um recurso. Usado ao invés de um id menos legível.

Permite referenciar um item preservando a habilidade de ver/saber qual item é.

Exemplo:

{
  "id": "1e120ac2-6490-4e6d-9b1d-3b117fd36a58",
  "name": "Books",
  "slug": "books"
}

Ao invés de:

GET /category/:id/products

GET /category/1e120ac2-6490-4e6d-9b1d-3b117fd36a58/products

Usamos:

GET /category/:slug/products

GET /category/books/products

Libs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment