-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Spike out an idea for the WebApplicationBuilder API. * Call onRequest on every request. * Get rid of intermediate Build() step. * Implement lifecycle hooks. * Refactor builder a little.
- Loading branch information
1 parent
8b17b3d
commit 35f589a
Showing
10 changed files
with
223 additions
and
100 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,29 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Frank.EndToEndTests | ||
{ | ||
class LifecycleHooksSpy | ||
{ | ||
public List<string> _list = new List<string>(); | ||
|
||
public void Before() | ||
{ | ||
_list.Add("before"); | ||
} | ||
|
||
public void After() | ||
{ | ||
_list.Add("after"); | ||
} | ||
|
||
public void Request() | ||
{ | ||
_list.Add("request"); | ||
} | ||
|
||
public void RouteHandler() | ||
{ | ||
_list.Add("route-handler"); | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,13 +1,18 @@ | ||
using System; | ||
using Frank.Internals; | ||
|
||
namespace Frank.API.WebDevelopers | ||
{ | ||
public interface IWebApplicationBuilder | ||
{ | ||
IWebApplicationBuilder WithRoutes(Action<IRouteConfigurer> action); | ||
IWebApplicationBuilder ListenOn(int port); | ||
IWebApplication Build(); | ||
ITestWebApplicationBuilder ForTesting(); | ||
IWebApplicationBuilder OnRequest(Action<IRouteConfigurer> action); | ||
IWebApplicationBuilderWithBefore<T> Before<T>(Func<T> onBefore); | ||
IWebApplication StartListeningOn(int port); | ||
ITestWebApplication StartTesting(); | ||
} | ||
|
||
public interface IWebApplicationBuilderWithBefore<T> | ||
{ | ||
IWebApplicationBuilderWithBefore<T> After(Action<T> onAfter); | ||
IWebApplicationBuilder OnRequest(Action<IRouteConfigurer, T> action); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
<Authors>[email protected]</Authors> | ||
<RepositoryUrl>https://github.com/craigjbass/Frank</RepositoryUrl> | ||
<LangVersion>8</LangVersion> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
|
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
Oops, something went wrong.