请问有人可以分享用F#编写的最小工作的ASP.NET Core应用程序项目吗?ASP.NET Core 1.0 F#项目
为了实现在C#中最小的演示中,我们必须做到以下几点:
mkdir aspnetcoreapp
cd aspnetcoreapp
dotnet new
然后编辑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"
}
}
}
然后执行dotnet restore
和使用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();
}
}
}
然后执行dotnet run
。任何人都可以给我一个提示如何在F#中做同样的事情?
您好,我想如果你有兴趣在F#ASP。NET核心Web开发,那么你可能会对这个NuGet库感兴趣:https://github.com/dustinmoris/AspNetCore.Lambda。我也在这里发表了博文:https://dusted.codes/functional-aspnet-core – dustinmoris