mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-11 18:54:52 +00:00
fix: add routes to get routing ports & all defined routes
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using Crestron.SimplSharp.WebScripting;
|
||||
using Newtonsoft.Json;
|
||||
using PepperDash.Core.Web.RequestHandlers;
|
||||
|
||||
namespace PepperDash.Essentials.Core.Web.RequestHandlers
|
||||
{
|
||||
public class GetRoutesHandler:WebApiBaseRequestHandler
|
||||
{
|
||||
private HttpCwsRouteCollection routeCollection;
|
||||
public GetRoutesHandler(HttpCwsRouteCollection routeCollection) {
|
||||
this.routeCollection = routeCollection;
|
||||
}
|
||||
|
||||
protected override void HandleGet(HttpCwsContext context)
|
||||
{
|
||||
var response = JsonConvert.SerializeObject(routeCollection);
|
||||
|
||||
context.Response.StatusCode = 200;
|
||||
context.Response.ContentType = "application/json";
|
||||
context.Response.Headers.Add("Content-Type", "application/json");
|
||||
context.Response.Write(response, false);
|
||||
context.Response.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user