Skip to content

rktuxyn/WebApi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Web Api C#

1) Map the route for the web api

using Owin;
using Microsoft.Owin;
using System.Collections.Generic;
[assembly: OwinStartup( typeof( SOW.Web.Api.View.Startup ) )]

namespace SOW.Web.Api.View {
    using SOW.Web.Api.Core.Extensions;
    using SOW.Web.Api.Core;
    public class Startup {
        public void Configuration( IAppBuilder app ) {
            app.MapWebApiRoute<ApiCnotrollers>( "/api" );
        }
    }
}

2) Inherit Api Cnotrollers from SOW.Web.Api.Core

using System.Threading.Tasks;
namespace SOW.Web.Api.View {
    using Microsoft.Owin;
    using SOW.Web.Api.Core;
    public class ApiCnotrollers : SOW.Web.Api.Core.ApiController {
        [Authorize]
        [Route( "/getdata/" )]
        public async Task<Task> GetData( ) {
          base.Response.ContentType = "application/json";
          return base.ResponseWriteAsync( _jss.Serialize( new {
                msg="Success"
            } ) );
         }
     }
 }

THANKS to Bryce Godfrey (https://github.com/bryceg/) for Owin.WebSocket

Releases

No releases published

Packages

No packages published

Languages