This file contains hidden or 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
| namespace OwinModulesHelloWorld | |
| { | |
| using Superscribe.Owin; | |
| public class HelloWorldModule : SuperscribeOwinModule | |
| { | |
| public HelloWorldModule() | |
| { | |
| this.Get["/"] = _ => "Hello world - OWIN style"; |
This file contains hidden or 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
| namespace OwinModulesHelloWorld | |
| { | |
| using System.IO; | |
| using Newtonsoft.Json; | |
| using Owin; | |
| using Superscribe.Owin; | |
| public class Startup | |
| { | |
| public void Configuration(IAppBuilder app) |
This file contains hidden or 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
| namespace OwinModulesHelloWorld | |
| { | |
| using Superscribe.Owin; | |
| public class HelloWorldModule : SuperscribeOwinModule | |
| { | |
| public HelloWorldModule() | |
| { | |
| this.Get["/"] = _ => "Hello world - OWIN style"; | |
| } |
This file contains hidden or 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
| <?xml version="1.0"?> | |
| <configuration> | |
| <system.web> | |
| <compilation debug="true" targetFramework="4.5" /> | |
| <httpRuntime targetFramework="4.5" /> | |
| </system.web> | |
| <appSettings> | |
| <add key="owin:HandleAllRequests" value="true" /> | |
| <add key="owin:SetCurrentDirectory" value="true" /> | |
| </appSettings> |
This file contains hidden or 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
| namespace OwinModulesHelloWorld | |
| { | |
| using Owin; | |
| using Superscribe.Owin; | |
| public class Startup | |
| { | |
| public void Configuration(IAppBuilder app) | |
| { |
This file contains hidden or 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.Get["Products" / (ʃLong)"Id"] = _ => | |
| { | |
| var service = _.Require<IProductsService>(); | |
| return service.Get(_.Parameters.Id); | |
| }; | |
| this.Post["Products"] = _ => | |
| { | |
| var service = _.Require<IProductsService>(); | |
| var product = _.Bind<Product>(); |
This file contains hidden or 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
| private static void RegisterServices(IKernel kernel) | |
| { | |
| kernel.Bind<IProductsService>().To<ProductsService>(); | |
| GlobalConfiguration.Configuration.DependencyResolver = new NinjectDependencyResolver(kernel); | |
| } |
This file contains hidden or 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.Post["Products"] = _ => | |
| { | |
| var product = _.Bind<Product>(); | |
| // Save product | |
| return _.Request.CreateResponse( | |
| HttpStatusCode.Created, | |
| new { Link = new { href = string.Format("http://api.localhost/products/{0}", product.Id) } }); | |
| }; |
This file contains hidden or 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
| namespace WebApiModuleHelloWorld | |
| { | |
| using System.Net; | |
| public class Product | |
| { | |
| public string Name { get; set; } | |
| public double Price { get; set; } | |
| } |
This file contains hidden or 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
| namespace WebApiModuleHelloWorld | |
| { | |
| using System; | |
| using Superscribe.Models; | |
| public class HelloWorldModule : Superscribe.WebApi.Modules.SuperscribeModule | |
| { | |
| public HelloWorldModule() | |
| { |