mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-05-06 03:32:57 +00:00
ASP.Net
This commit is contained in:
parent
b57352b013
commit
6cae4b3086
@ -9,10 +9,12 @@
|
||||
<Authors>Ahmed Kh. Zamil</Authors>
|
||||
<Company>Esiur Foundation</Company>
|
||||
|
||||
<PackageLicenseUrl>https://github.com/Esiur/Esiur-dotnet/blob/master/LICENSE</PackageLicenseUrl>
|
||||
<PackageProjectUrl>http://www.esiur.com</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/esiur/esiur-dotnet/</RepositoryUrl>
|
||||
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
@ -27,6 +29,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Esiur\Esiur.csproj" />
|
||||
<None Include="README.md" Pack="true" PackagePath="\"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
51
Esiur.AspNetCore/README.md
Normal file
51
Esiur.AspNetCore/README.md
Normal file
@ -0,0 +1,51 @@
|
||||
# Esiur ASP.Net Core Middleware
|
||||
|
||||
This project brings Esiur distributed resource framework to ASP.Net using WebSockets in the ASP.Net pipeline.
|
||||
# Installation
|
||||
- Nuget
|
||||
```Install-Package Esiur.AspNetCore```
|
||||
- Command-line
|
||||
``` dotnet add package Esiur.AspNetCore ```
|
||||
# Example
|
||||
```C#
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.WebHost.UseUrls("http://localhost:8080");
|
||||
var app = builder.Build();
|
||||
|
||||
app.UseWebSockets();
|
||||
|
||||
await Warehouse.Put("sys", new MemoryStore());
|
||||
await Warehouse.Put("sys/service", new MyResource());
|
||||
var server = await Warehouse.Put("sys/server", new DistributedServer());
|
||||
await Warehouse.Open();
|
||||
|
||||
app.UseEsiur(new EsiurOptions() { Server = server });
|
||||
|
||||
await app.RunAsync();
|
||||
```
|
||||
|
||||
## MyResource.cs
|
||||
|
||||
```c#
|
||||
[Resource]
|
||||
public partial class MyResource
|
||||
{
|
||||
[Export] int number;
|
||||
[Export] public string Hello() => "Hi";
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Calling from JavaScript
|
||||
|
||||
Esiur provides a command line interpreter for debugging using Node.JS which can be installed using
|
||||
```npm install -g esiur```
|
||||
|
||||
To access the shell
|
||||
```esiur shell```
|
||||
|
||||
Now you can simply test the running service typing
|
||||
```javascript
|
||||
let x = await wh.get("iip://localhost:8080/sys/service", {secure: false});
|
||||
await x.Hello();
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user