![websharper 框架](https://i-blog.csdnimg.cn/blog_migrate/76c171eafc66dcbdd22b9c24e9d690e9.png)
websharper 框架
Last month after I wrote a small prototype to get the F# Suave.io web framework running on Azure Web Apps (a git deployed managed Platform as a Service) I started looking for more F# Azure resources.
上个月,我写了一个小型原型使F#Suave.io Web框架在Azure Web Apps (运行git部署的托管平台即服务)上运行之后,我开始寻找更多的F#Azure资源。
Here's a list of some other existing F# programming technologies that are great with Azure. Did I miss any? I surely did. There's a huge list up at FSharp.org for resources running F# on any cloud.
这是一些其他适用于Azure的现有F#编程技术的列表。 我有想念吗? 我当然做到了FSharp.org上有一个庞大的清单,用于在任何云上运行F#的资源。
Fog (an F# Azure data scripting API)
雾(F#Azure数据脚本API)
MBrace (a scalable distributed programming model for F#)
MBrace (F#的可伸缩分布式编程模型)
FSharp.Data (a set of F# type providers for common cloud data manipulation scenarios)
FSharp.Data (一组用于常见云数据处理方案的F#类型提供程序)
Suave (a simple web development F# library for lightweight microservices including route flow and task composition)
Suave (一个简单的Web开发F#库,用于轻量级微服务,包括路由流程和任务组成)
FSharp.CloudAgent - a simple framework to easily distribute workloads over the cloud using standard F# Agents as the processing mechanism. Support exists for both simple and reliable messaging via Azure Service Bus, and for both workers and actors.
FSharp.CloudAgent-一个简单的框架,可使用标准F#代理作为处理机制轻松地在云上分配工作负载。 通过Azure Service Bus既支持简单可靠的消息传递,也支持工作人员和参与者。
AzureStorageTypeProvider - An F# Azure Type Provider which can be used to explore Blob, Table and Queue Azure Storage assets and easily apply CRUD operations on them
AzureStorageTypeProvider -F#Azure类型提供程序,可用于浏览Blob,表和队列Azure存储资产并轻松在其上应用CRUD操作
Try F# - A web programming console for F# that can be reoriented towards Azure programmability
尝试F# -用于F#的Web编程控制台,可以将其重定向为Azure可编程性
HadoopFs - A lightweight F# implementation of the Hadoop Streaming API
HadoopFs -Hadoop流API的轻量级F#实现
FSharp.Azure - A wrapper over WindowsAzure.Store using idiomatic F#
FSharp.Azure-使用惯用的F#封装WindowsAzure.Store
There's also the WebSharper web framework. WebSharper isn't ASP.NET with F#, it's its own idiomatic thing. What's that really mean, "idiomatic?"
还有WebSharper Web框架。 WebSharper不是带有F#的ASP.NET,而是它自己的惯用语。 真正的意思是“惯用的”吗?
You know how when you Google Translate a sentence it doesn't quite work? I mean, it works, but it doesn't feel right. It doesn't feel right because the translator understands the words, and some phrases, but not the idioms - the underlying thoughts that are unique to that language. There was a time a few years back when folks were constantly looking for C# to VB convertors. This is something that's quite possible, almost line for line. However, changing an imperative language into a functional one is not like turning American English into British English. ;) Let functional languages be functional.
你知道当你谷歌翻译一个句子就完全不是那么回事? 我的意思是,它有效,但是感觉不正确。 感觉不对,因为翻译者能理解单词和某些短语,但不能理解习语-该语言特有的基本思想。 几年前,人们一直在寻找将C#转换为VB转换器的方法。 这是很有可能的,几乎是逐行的。 但是,将命令式语言转换为功能性语言并不像将美式英语转换为英式英语一样。 ;)让功能语言发挥作用。
F# people like to do things their way and the language has very different goals and ideas than C# so it makes sense there would be a opinionated web framework for F#. I like it.
F#人们喜欢以自己的方式做事,并且该语言的目标和思想与C#完全不同,因此可以为F#建立一个自以为是的Web框架。 我喜欢。
(Although I'm sure there will be a way to use ASP.NET 5 and MVC with F# in the future, this post isn't about that.)
(尽管我确定将来会有一种将ASP.NET 5和MVC与F#结合使用的方法,但本文并非如此。)
WebSharper has a VS Extension so you can File New new projects, and here's a hello world ToDo List app (minus the HTML view, which you can see here)
WebSharper有一个VS Extension,因此您可以归档新项目,这是一个世界一流的ToDo List应用程序(减去HTML视图,您可以在此处查看)
namespace UINextApplication1
open WebSharper
open WebSharper.JavaScript
open WebSharper.JQuery
open WebSharper.UI.Next
open WebSharper.UI.Next.Notation
[<JavaScript>]
module Client =
type IndexTemplate = Templating.Template<"index.html">
let Tasks = ListModel.FromSeq ["Have breakfast"]
let Main =
JQuery.Of("#tasks").Empty().Ignore
let newName = Var.Create ""
IndexTemplate.Main.Doc(
ListContainer =
(ListModel.View Tasks |> Doc.Convert (fun name ->
IndexTemplate.ListItem.Doc(
Task = View.Const name,
Done = (fun e -> Tasks.Remove name)))
),
Task = newName,
Add = (fun e ->
Tasks.Add(newName.Value)
Var.Set newName "")
)
|> Doc.RunById "tasks"
More interesting is the recent blog post by Adam Granicz where he expands on my "Suave to Azure via GitHub" prototype and shows how to deploy a real F# WebSharper app to Azure Websites via GitHub.
更有趣的是Adam Granicz的最新博客文章,他在我的“通过GitHub到Azure生存”原型上进行了扩展,并展示了如何通过GitHub将真正的F#WebSharper应用程序部署到Azure网站。
One of the main improvements is that my solution used FAKE and I found myself wanting a binary version of the FSharp compiler as NuGet. An issue was open and closed within days, simplifying the deployment. Additionally their WebSharper solution creates an ASP.NET app that runs in the context of ASP.NET and IIS, while my Suave solution needed a separate process. WebSharper 3.1 was recently released, and you can see their sample running live in Azure here: http://websharper-clientserver.azurewebsites.net
主要的改进之一是我的解决方案使用了FAKE,我发现自己想要FSharp编译器的二进制版本为NuGet。 几天之内就解决了一个问题,简化了部署。 此外,他们的WebSharper解决方案创建了一个在ASP.NET和IIS上下文中运行的ASP.NET应用程序,而我的Suave解决方案则需要一个单独的过程。 WebSharper 3.1是最近发布的,您可以在以下位置看到其示例在Azure中实时运行: http : //websharper-clientserver.azurewebsites.net
And of course, you can deploy it to Azure right from here using the Deploy to Azure button!
当然,您可以使用“部署到Azure”按钮从此处直接将其部署到Azure!
Do you dabble in F#, are you doing F# professionally? What do you think about F#-based web applications?
您是否涉足F#,您是否在专业从事F#? 您如何看待基于F#的Web应用程序?
Sponsor: Big thanks to Atalasoft for sponsoring the blog and feed this week! If your company works with documents, definitely check out Atalasoft's developer tools for web & mobile viewing, capture, and transformation. They've got free trials and a remarkable support team, too.
赞助商:非常感谢Atalasoft赞助了本周的博客和feed! 如果您的公司使用文档,则一定要使用Atalasoft的开发人员工具来进行Web和移动查看,捕获和转换。 他们也有免费试用版和出色的支持团队。
websharper 框架