CenterForDigitalHumanities / CenterForDigitalHumanities/rerum_server_nodejs

EPIC slug aggregator

Ouverte
#151 7 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
JavaScript
Étoiles
3
Forks
6
Merge moyen
2 j 47 min
PR mergées (30 j)
4

Description

We've got some light slug functionality, but we need it to work all the time. Here's what they do...

> ## 9.7. The Slug Header [link](https://tools.ietf.org/html/rfc5023#section-9.7)
> Slug is an HTTP entity-header whose presence in a POST to a Collection constitutes a request by the client to use the header’s value as part of any URIs that would normally be used to retrieve the to-be-created Entry or Media Resources.
>
> Servers MAY use the value of the Slug header when creating the Member URI of the newly created Resource, for instance, by using some or all of the words in the value for the last URI segment.

In addition to the "get by `_id`" lookup for documents, a request like "https://store.rerum.io/v1/id/slug-life" should return the document matching `{ "__rerum.slug" : "slug-life" }` in the repository.

An application suggests a slug by passing in a `slug` header in the CREATE POST or by adding a "?slug=" query string. If both exist, the header is used as the server will ignore query strings.

RERUM saves a new object with the `__rerum.slug` property and separate generated `_id`. RERUM responds with the normalized slug in the `@id` field of the response object.

In an update, a document owner can move the slug to a new version, prompting RERUM to update the `__rerum.slug` properties for both records.

API behaviors will be listed below as they may each interreact differently. Slug conditions in all cases are clear:

1. Only one document can hold a slug at any time.
2. Only the owner can move slug from one document to another.
3. Slugs are entirely lowercase, with accented characters replaced by letters from the English alphabet and whitespace characters replaced by a dash or an underscore, in order to avoid being encoded. Punctuation marks are generally removed.
- This, That & the Other! Various Outré Considerations <= input
- this-that-the-other-various-outre-considerations <= stored slug
1. Slugs are trimmed to 50 characters.
2. A document may only have one slug assigned to it at a time.
5. Slugs are helpful and efficient, but not a promise of durability, so the `_id` must be used in all versioning.
- A "/since/slug" request with a slug is not idempotent, because the slug may have moved, but "since/_id" is.
- An "/id/slug" request may not always return the same document and may go 404, which a deleted document does not.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par retracer les chemins de requête documentés /v1/id/slug et /since/slug, puis examinez la gestion de CREATE POST et des mises à jour pour l’en-tête slug et la chaîne de requête ?slug=. Utilisez les règles indiquées de normalisation, de propriété, d’unicité, de longueur et de versionnement comme critères d’acceptation, y compris la distinction entre les recherches par slug et par _id.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript
Domaine
api, backend, databases
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.