orad
orad

Reputation: 16074

Using a .NET class library in NodeJS app using Blazor

I have a .NET Standard project that includes a bunch of models and methods, and I want to use them in a NodeJS application written in TypeScript. All the samples I see for Blazor JavaScript interop integrate with JS through Razor files, but I couldn't find any samples that show how to integrate .NET code with NodeJS. Is this possible at all and if yes, how? Thanks!

Upvotes: 2

Views: 2586

Answers (1)

codevision
codevision

Reputation: 5560

This is not possible Client-side Blazor works only in browser and interop is only with browser JS, since it is browser who run WASM and JS inside themselves.

Previously you can theoretically integrate some NodeJS inside ASP.NET Core application using NodeServices, but they are would be obsolete in .NET Core 3. See https://github.com/aspnet/AspNetCore/issues/12890

If you want to run some code from Blazor inside NodeJS likely you have to create separate command line application and communicate between it and your NodeJS application.

Upvotes: 2

Related Questions