Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use middleware to validate post slugs #115

Merged
merged 2 commits into from
Oct 18, 2024
Merged

Use middleware to validate post slugs #115

merged 2 commits into from
Oct 18, 2024

Conversation

syeopite
Copy link
Owner

This PR removes the slug check logic from the former route handlers
_blog_post and _blog_post_no_slug. Replacing this, is a middleware
that handles the slug check logic instead.

By using a middleware, we can apply this logic uniformly to all
additional blog post routes. For example for a post note viewer
ensuring that the endpoints to view post notes always has the correct
slug if applicable, and to remove the given slug if unnecessary.

As the logic that separated the slug and slugless post routes have
been transformed to a single middleware, these two routes have been
merged to use the same handler.

Splits blog and blog post routes into two files and intergrated via
a blueprint group
This commit removes the slug check logic from the former route handlers
`_blog_post` and `_blog_post_no_slug`. Replacing this, is a middleware
that handles the slug check logic instead.

By using a middleware, we can apply this logic uniformly to all
additional blog post routes. For example for a post note viewer
ensuring that the endpoints to view post notes always has the correct
slug if applicable, and to remove the given slug if unnecessary.

As the logic that separated the slug and slugless post routes have
been transformed to a single middleware, these two routes have been
merged to use the same handler.
@syeopite syeopite merged commit eab4183 into master Oct 18, 2024
@syeopite syeopite deleted the handle-slug-before branch February 18, 2025 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant