diff --git a/src/PepperDash.Essentials.Core/Web/EssentialsWebApi.cs b/src/PepperDash.Essentials.Core/Web/EssentialsWebApi.cs index 3030cd81..06d5f6c0 100644 --- a/src/PepperDash.Essentials.Core/Web/EssentialsWebApi.cs +++ b/src/PepperDash.Essentials.Core/Web/EssentialsWebApi.cs @@ -11,7 +11,7 @@ namespace PepperDash.Essentials.Core.Web { public class EssentialsWebApi : EssentialsDevice { - private readonly WebApiServer _server; + private readonly WebApiServer _server; /// /// http(s)://{ipaddress}/cws/{basePath} @@ -67,8 +67,6 @@ namespace PepperDash.Essentials.Core.Web _server = new WebApiServer(Key, Name, BasePath); SetupRoutes(); - - Initialize(); } private void SetupRoutes() @@ -175,6 +173,27 @@ namespace PepperDash.Essentials.Core.Web } } + /// + /// Add a single route to the API. MUST be done during the activation phase + /// + /// + public void AddRoute(HttpCwsRoute route) + { + _server.AddRoute(route); + } + + /// + /// Add a collection of routes to the API. MUST be done during the activation phase + /// + /// + public void AddRoute(List routes) + { + foreach (var route in routes) + { + AddRoute(route); + } + } + /// /// Initializes the CWS class ///