add url api
All checks were successful
ci/woodpecker/push/validate_schema Pipeline was successful

This commit is contained in:
JMARyA 2024-12-16 10:30:51 +01:00
parent 619913dec3
commit 064dc6c5d3
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
2 changed files with 18 additions and 0 deletions

View file

@ -2,6 +2,9 @@
obj: meta/collection obj: meta/collection
--- ---
# Best Practices
- [URL Suffix API](./URL%20Suffix%20API.md)
# Creational Patterns # Creational Patterns
- [Abstract Factory](creational/Abstract%20Factory%20Pattern.md) - [Abstract Factory](creational/Abstract%20Factory%20Pattern.md)
- [Builder](creational/Builder%20Pattern.md) - [Builder](creational/Builder%20Pattern.md)

View file

@ -0,0 +1,15 @@
# URL Suffix API
When designing a website, consider leveraging URL suffixes to indicate the format of the resource being accessed, similar to how file extensions are used in operating systems.
For example, a webpage located at `/blog/post/id` that renders human-readable content could have its machine-readable data served by appending a format-specific suffix to the same URL, such as `/blog/post/id.json`.
#### Benefits:
1. **Intuitive API from Website Usage**
Users can easily derive API endpoints from existing website URLs by appending the desired format suffix.
2. **Interchangeable Formats**
The same approach allows for multiple formats (e.g., `.json`, `.msgpack`, `.protobuf`) to be supported seamlessly, improving flexibility and usability.
This method simplifies the architecture, enhances consistency, and provides an elegant mechanism to serve both human-readable and machine-readable content from the same base URL.