mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-13 20:47:04 +00:00
feat: add methods to add routes to API
This commit is contained in:
parent
420ae8c7de
commit
e0e08ba22c
1 changed files with 22 additions and 3 deletions
|
|
@ -11,7 +11,7 @@ namespace PepperDash.Essentials.Core.Web
|
||||||
{
|
{
|
||||||
public class EssentialsWebApi : EssentialsDevice
|
public class EssentialsWebApi : EssentialsDevice
|
||||||
{
|
{
|
||||||
private readonly WebApiServer _server;
|
private readonly WebApiServer _server;
|
||||||
|
|
||||||
///<example>
|
///<example>
|
||||||
/// http(s)://{ipaddress}/cws/{basePath}
|
/// http(s)://{ipaddress}/cws/{basePath}
|
||||||
|
|
@ -67,8 +67,6 @@ namespace PepperDash.Essentials.Core.Web
|
||||||
_server = new WebApiServer(Key, Name, BasePath);
|
_server = new WebApiServer(Key, Name, BasePath);
|
||||||
|
|
||||||
SetupRoutes();
|
SetupRoutes();
|
||||||
|
|
||||||
Initialize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetupRoutes()
|
private void SetupRoutes()
|
||||||
|
|
@ -175,6 +173,27 @@ namespace PepperDash.Essentials.Core.Web
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add a single route to the API. MUST be done during the activation phase
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="route"></param>
|
||||||
|
public void AddRoute(HttpCwsRoute route)
|
||||||
|
{
|
||||||
|
_server.AddRoute(route);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add a collection of routes to the API. MUST be done during the activation phase
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="routes"></param>
|
||||||
|
public void AddRoute(List<HttpCwsRoute> routes)
|
||||||
|
{
|
||||||
|
foreach (var route in routes)
|
||||||
|
{
|
||||||
|
AddRoute(route);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes the CWS class
|
/// Initializes the CWS class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue