-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from stifskere/dev
feat: middleware structure
- Loading branch information
Showing
7 changed files
with
57 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using JetBrains.Annotations; | ||
using MemwLib.Http.Types.Entities; | ||
|
||
namespace MemwLib.Http.Types.Attributes; | ||
|
||
/// <summary> | ||
/// Base middleware class, every class extending this | ||
/// one will be counted as middleware within the HTTPServer | ||
/// </summary> | ||
[PublicAPI] | ||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)] | ||
public abstract class MiddlewareAttribute : Attribute | ||
{ | ||
/// <summary> | ||
/// This method will be ran every time a route | ||
/// or route group with this middleware is called. | ||
/// </summary> | ||
/// <param name="request">The incoming request from the server.</param> | ||
/// <returns> | ||
/// A ResponseEntity to end the request or a NextMiddleware instance | ||
/// telling the server to call the next corresponding handler for this request. | ||
/// </returns> | ||
public abstract IResponsible Handler(RequestEntity request); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters