-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathProgram.cs
21 lines (17 loc) · 889 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Pchp.Core;
using webassembly;
using webassembly.Services;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Services
.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) })
.AddScoped(sp => Context.CreateEmpty()) // PHP request context - Lifecycle of a PHP request. // NOTE: can be created as Singleton() to remember all the globals and includes across all requests!
.AddScoped<PhpInterop>() // helper service utilizing PeachPie API
;
// get php.dll assembly, and load its scripts into the application memory
Context.AddScriptReference(typeof(Dummy).Assembly);
// run server
await builder.Build().RunAsync();