Public ValuesController(IRepository repository) For more information on, please see this post by Tuberk Ugurlu. Var engine = OwinRouteEngineFactory.Create(options) įor this example you'll need to install and package from nuget. ("text/html", options.MediaTypeHandlers) Replace text/html with json handler so example works in a browser Obj = JsonConvert.DeserializeObject(reader.ReadToEnd(), type) Using (var reader = new StreamReader(env.GetRequestBody())) Write = (env, o) => env.WriteResponse(JsonConvert.SerializeObject(o)), ("application/json", new MediaTypeHandler Var options = new SuperscribeOwinOptions() Public void Configuration(IAppBuilder app) Public class ValuesController : ApiController Public class BlogsController : ApiController Var blogs = define.Route("api" / "Blogs".Controller() / (Int)"blogid") ĭefine.Get(blogs / "Posts", To.Action("GetBlogPosts")) ĭefine.Get(blogs / "Tags", To.Action("GetBlogTags")) ĭefine.Post(blogs / "Posts", To.Action("PostBlogPost")) ĭefine.Post(blogs / "Tags", To.Action("PostBlogTag")) Var define = SuperscribeConfig.Register(config) Public static void Register(HttpConfiguration config) Please note that Superscribe only supports Asp.Net Web Api 2.1 and above Pipeline() to configure dependency injection based on routes (WebApi, Owin) Routing and Pipelining Middleware Shows how to build a custom pipeline branch based on a route (Owin)Ĭonfiguring Dependencies per Request Using. Using Parameters in other Middleware Shows how to use parameters captured during routing in other middleware (Owin) Owin Modules Shows how to set up modules that accept POST requests and perform model binding (Owin) Hello World Basic hello world example (Owin) Handing control to frameworks Shows how to perform routing and then pass control over to web frameworks accordingly (Owin) Web Api on Owin How to set up Superscribe to work with Web Api when using Owin hosting (Web Api, Owin) Multiple Collections Per Controller Shows how to route multiple collection resources to the same controller (Web Api)Ĭombine with other Routing Using Superscribe routes and modules alongside traditional/attribue routing (Web Api) Web Api - Basic How to replicate the default route with Superscribe (Web Api) Unit Testing Shows how to unit test Superscribe routes (Generic) Fluent Api Shows how to define routes and custom nodes using the Fluent Api (Generic)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |