From e0ecb2a28533daa8ff0a827bb2c27164546007dc Mon Sep 17 00:00:00 2001 From: Chris Kaczor Date: Sat, 3 Aug 2019 08:36:57 -0400 Subject: [PATCH] Update REST endpoints --- Hub/Service/Controllers/ValuesController.cs | 29 ++----------------- Hub/Service/Properties/launchSettings.json | 4 +-- Hub/Service/deploy/manifest.yaml | 2 +- .../Service/Controllers/ValuesController.cs | 17 +---------- .../Service/Properties/launchSettings.json | 2 +- Weather/Service/deploy/manifest.yaml | 20 ++++++++++++- 6 files changed, 26 insertions(+), 48 deletions(-) diff --git a/Hub/Service/Controllers/ValuesController.cs b/Hub/Service/Controllers/ValuesController.cs index b324e7c..2696a48 100644 --- a/Hub/Service/Controllers/ValuesController.cs +++ b/Hub/Service/Controllers/ValuesController.cs @@ -3,40 +3,15 @@ using System.Collections.Generic; namespace ChrisKaczor.HomeMonitor.Hub.Service.Controllers { - [Route("api/[controller]")] + [Route("[controller]")] [ApiController] public class ValuesController : ControllerBase { - // GET api/values + // GET values [HttpGet] public ActionResult> Get() { return new[] { "value1", "value2" }; } - - // GET api/values/5 - [HttpGet("{id}")] - public ActionResult Get(int id) - { - return "value"; - } - - // POST api/values - [HttpPost] - public void Post([FromBody] string value) - { - } - - // PUT api/values/5 - [HttpPut("{id}")] - public void Put(int id, [FromBody] string value) - { - } - - // DELETE api/values/5 - [HttpDelete("{id}")] - public void Delete(int id) - { - } } } diff --git a/Hub/Service/Properties/launchSettings.json b/Hub/Service/Properties/launchSettings.json index e3f2ce2..61dbd97 100644 --- a/Hub/Service/Properties/launchSettings.json +++ b/Hub/Service/Properties/launchSettings.json @@ -12,7 +12,7 @@ "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, - "launchUrl": "api/values", + "launchUrl": "values", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } @@ -20,7 +20,7 @@ "Service": { "commandName": "Project", "launchBrowser": true, - "launchUrl": "api/values", + "launchUrl": "values", "applicationUrl": "http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" diff --git a/Hub/Service/deploy/manifest.yaml b/Hub/Service/deploy/manifest.yaml index 8fe0c7e..6f8558c 100644 --- a/Hub/Service/deploy/manifest.yaml +++ b/Hub/Service/deploy/manifest.yaml @@ -59,7 +59,7 @@ spec: rules: - http: paths: - - path: "/hub" + - path: "/api/hub" backend: serviceName: hub-service servicePort: 80 \ No newline at end of file diff --git a/Weather/Service/Controllers/ValuesController.cs b/Weather/Service/Controllers/ValuesController.cs index 1e5784d..a45cc90 100644 --- a/Weather/Service/Controllers/ValuesController.cs +++ b/Weather/Service/Controllers/ValuesController.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; namespace ChrisKaczor.HomeMonitor.Weather.Service.Controllers { - [Route("api/[controller]")] + [Route("[controller]")] [ApiController] public class ValuesController : ControllerBase { @@ -12,20 +12,5 @@ namespace ChrisKaczor.HomeMonitor.Weather.Service.Controllers { return new[] { "value1", "value2" }; } - - [HttpGet("{id}")] - public ActionResult Get(int id) - { - return "value"; - } - - [HttpPost] - public void Post([FromBody] string value) { } - - [HttpPut("{id}")] - public void Put(int id, [FromBody] string value) { } - - [HttpDelete("{id}")] - public void Delete(int id) { } } } \ No newline at end of file diff --git a/Weather/Service/Properties/launchSettings.json b/Weather/Service/Properties/launchSettings.json index 803cbaa..cbedba3 100644 --- a/Weather/Service/Properties/launchSettings.json +++ b/Weather/Service/Properties/launchSettings.json @@ -3,7 +3,7 @@ "profiles": { "Service": { "commandName": "Project", - "launchUrl": "api/values", + "launchUrl": "values", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, diff --git a/Weather/Service/deploy/manifest.yaml b/Weather/Service/deploy/manifest.yaml index 9a12afb..fb70186 100644 --- a/Weather/Service/deploy/manifest.yaml +++ b/Weather/Service/deploy/manifest.yaml @@ -123,4 +123,22 @@ spec: dnsPolicy: ClusterFirst nodeSelector: kubernetes.io/hostname: kubernetes - schedulerName: default-scheduler \ No newline at end of file + schedulerName: default-scheduler +--- +kind: Ingress +apiVersion: extensions/v1beta1 +metadata: + name: weather + namespace: home-monitor + annotations: + kubernetes.io/ingress.class: traefik + nginx.ingress.kubernetes.io/ssl-redirect: 'false' + traefik.frontend.rule.type: PathPrefixStrip +spec: + rules: + - http: + paths: + - path: "/api/weather" + backend: + serviceName: weather-service + servicePort: 80 \ No newline at end of file