All Projects → bbaia → connect-owin

bbaia / connect-owin

Licence: Apache-2.0 license
Node.js connect middleware for .NET using OWIN

Programming Languages

C#
18002 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to connect-owin

Multitenancy-Microservice-FederatedIdentity-Example
Multitenancy Federated Identity Example ASP.NET MVC C#
Stars: ✭ 33 (-28.26%)
Mutual labels:  owin
Microsoft.Owin.Security.QQ-WebChat
QQ and Webchat extensions for Microsoft.Owin.Security
Stars: ✭ 20 (-56.52%)
Mutual labels:  owin
Owin.Security.AesDataProtectorProvider
OWIN AES data protector provider
Stars: ✭ 26 (-43.48%)
Mutual labels:  owin
Fos
FastCgi Server designed to run Owin applications side by side with a FastCgi enabled web server.
Stars: ✭ 65 (+41.3%)
Mutual labels:  owin
oauth-aspnet
An ASP.NET Core compatible port of the OAuth Authorization Server Middleware from Microsoft's Project Katana (Microsoft.Owin.Security.OAuth)
Stars: ✭ 25 (-45.65%)
Mutual labels:  owin
WebApiStartTemplate
Web API Visual Studio Template.
Stars: ✭ 15 (-67.39%)
Mutual labels:  owin
Owin.HealthCheck
Health Check Middleware for the OWIN pipeline
Stars: ✭ 22 (-52.17%)
Mutual labels:  owin
NLog.Owin.Logging
NLog logging adapter for OWIN
Stars: ✭ 25 (-45.65%)
Mutual labels:  owin
embedio-extras
Additional Modules showing how to extend EmbedIO.
Stars: ✭ 43 (-6.52%)
Mutual labels:  owin
LeXun.Security.OAuth
用于 Asp.Net 和 Asp.Net Core 的OAuth2社交身份验证提供程序。支持支付宝,QQ,微信,百度等第三方登录
Stars: ✭ 19 (-58.7%)
Mutual labels:  owin
Simplify.Web
Moved to https://github.com/SimplifyNet. Simplify.Web is a lightweight and fast server-side .NET web-framework based on MVC and OWIN for building HTTP based web-applications, RESTful APIs etc.
Stars: ✭ 23 (-50%)
Mutual labels:  owin

connect-owin Build Status

Implement node.js connect middleware in .NET using OWIN.

Versions are incremented according to semver.

This is a fork of Tomasz Janczuk's original code; thanks go to him for getting this thing started!

Introduction

OWIN itself is not a technology, just a specification to decouple Web applications from the Web server. The goal of connect-owin is to implement this specification to use node.js, through connect framework, as the Web Server.

The connect-owin exports a function that returns a connect middleware. The function takes the path of the OWIN .NET assembly file as a parameter. The following code shows how to use connect-owin with express.js, a Web framework built on connect:

var owin = require('connect-owin'),
    express = require('express');

var app = express();
app.all('/net', owin('MyAssembly.dll'));
// ...
app.listen(3000);

.NET OWIN middlewares can be implemented in two ways with connect-owin:

  • By implementing the OWIN primary interface Func<IDictionary<string, object>, Task>:
public class Startup
{
  public Task Invoke(IDictionary<string, object> env) 
  {
    // ...
  }
}
  • By using the IAppBuilder interface that acts as the glue for any .NET OWIN middleware, exactly how connect in node.js works:
public class Startup
{
  public void Configuration(IAppBuilder builder)
  {
    // ...
  }
}

The connect-owin function uses <assembly name>.Startup as default type name, and Configuration as default method name. Custom type and method name can be provided via an options object:

owin({
    assemblyFile: 'MyAssembly.dll',
    typeName: 'MyNamespace.MyType',
    methodName: 'MyMethodName'
});

Requirements

Building

Grunt is used to build, test and preview the sample on all platforms.

First, install connect-owin dependencies:

$ npm install

Then, you'll need to install Grunt's command line interface (CLI) globally:

$ npm install -g grunt-cli

You can build sources, run tests and preview the sample by using the default Grunt task:

$ grunt

Building sources

$ grunt build

The build creates the lib\clr\Connect.Owin.dll file required by the lib\connect-owin.js library.

Running the sample

Using Grunt

The following command uses the grunt-contrib-connect task to start a connect web server with the .NET OWIN application plugged in as a middleware and open the page in your default browser:

$ grunt hello

Using express.js

An express.js sample is also provided to run the .NET OWIN application:

$ cd examples\hello
$ npm install express
$ node server.js

Then go to http://localhost:3000/node. This should display a message from an express middleware in node.js.

If you go to http://localhost:3000/net, you should see a similar message from the .NET OWIN application in Owin.Connect.Examples.Hello.dll plugged in as a middleware to the express pipeline.

Using webpack-dev-server

A webpack sample is also provided to allow the webpack development server to serve your .NET OWIN application:

$ npm install -g webpack
$ npm install -g webpack-dev-server
$ webpack-dev-server --config webpack.config.js

Then go to http://localhost:8080/net. This should display a message from the .NET OWIN application.

More samples available @ connect-owin-samples

Running tests

$ grunt test

mocha is used to run tests.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].