Web API in Wisej app

0
0

Hello,

How to create a Web api (like asp.net api controllers) in a wisej app?
If this is not supported by default what is the best approach?

thanks…

  • You must to post comments
0
0

Hi Ali,

For my education, why would you want to create a Web Api in the Wisej application? Why not create a separate application for that?

Best,

Alex

  • Ali Badran
    Imagine any asp.net app, it may contain pages or web apis at the same time. I have the same situation
  • Alex Prinias
    Thank you for your answer. I understand that any asp.net app may contain web apis. What I don’t understand is why it would be beneficial to have them in a wisej app and not in a separate app running on the same server (or different web server) and accessing the same database. I’ m asking to find out if there is an advantage I’missing out. Many thanks again.
  • You must to post comments
1
0

Hi Ali,

If you’re using .NET Core you can use Simple APIs. Add this to Startup.cs:

app.MapGet("/data", () =>
{
 var random = new Random();
 var data = new List<dynamic>();

 for (var i = 0; i < 10; i++)
 {
 data.Add(new { index = i, value = random.Next(10000) });
 }

 return JSON.Stringify(data);
});

If you’re using .NET Framework you can register an IHttpModule, see this link for a demo that shows an implementation:

https://github.com/iceteagroup/wisej-extensions/tree/2.2/Wisej.Web.Ext.OfficeViewer

 

Best,

Levie

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.