This commit is contained in:
parent
619913dec3
commit
064dc6c5d3
2 changed files with 18 additions and 0 deletions
|
@ -2,6 +2,9 @@
|
|||
obj: meta/collection
|
||||
---
|
||||
|
||||
# Best Practices
|
||||
- [URL Suffix API](./URL%20Suffix%20API.md)
|
||||
|
||||
# Creational Patterns
|
||||
- [Abstract Factory](creational/Abstract%20Factory%20Pattern.md)
|
||||
- [Builder](creational/Builder%20Pattern.md)
|
||||
|
|
15
technology/dev/programming/patterns/URL Suffix API.md
Normal file
15
technology/dev/programming/patterns/URL Suffix API.md
Normal 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.
|
Loading…
Add table
Reference in a new issue