Qualcuno potrebbe condividere un progetto di applicazione ASP.NET Core minimo scritto in F #?Progetto ASP.NET Core 1.0 F #
Per implementare una demo minimo in C#, dobbiamo fare quanto segue:
mkdir aspnetcoreapp
cd aspnetcoreapp
dotnet new
Quindi modificare project.json
:
{
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true
},
"dependencies": {},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
},
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0"
},
"imports": "dnxcore50"
}
}
}
Quindi eseguire dotnet restore
e utilizzando questo codice follwoing:
Startup.cs
:
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
namespace aspnetcoreapp
{
public class Startup
{
public void Configure(IApplicationBuilder app)
{
app.Run(context =>
{
return context.Response.WriteAsync("Hello from ASP.NET Core!");
});
}
}
}
Program.cs
:
using System;
using Microsoft.AspNetCore.Hosting;
namespace aspnetcoreapp
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
Quindi eseguire dotnet run
. Qualcuno potrebbe darmi un suggerimento su come fare la stessa cosa in F #?
Ciao, ho pensato che se siete interessati a F # ASP.Sviluppo web di NET Core quindi potresti essere interessato a questa libreria NuGet: https://github.com/dustinmoris/AspNetCore.Lambda. Ho anche scritto un blog qui: https://dusted.codes/functional-aspnet-core – dustinmoris