Haxe Web 框架
我刚刚开始研究 Haxe 语言,主要用于 flash 开发,但是当我了解了 Neko 的功能后,我也了解了 Neko 的功能,以及桌面和 Web 服务器方面的功能。
我有点关注 Flash 方面的事情 - 只需要多玩玩它,但当涉及到用它创建 MVC 网站时我有点迷失了。
在构建网站时,您有什么建议(这只是一个基本网站,具有不同的部分来理解控制器/操作/ID)?我知道 PureMVC 是一个相当完善的框架,但在这种情况下,如何(如果)实现它?
我希望有一些类似于 ASP.NET MVC 的东西,我已经简单地浏览过它,但没有时间正确使用。
非常感谢您的任何建议。
I'm just beginning to look at the Haxe language, primarily for flash development, but once I'd seen what Neko can do, also the desktop and web server side of things too.
I sort of have my head around the flash side of things - just need to play with it a bit more, but I'm a bit lost when it comes to creating an MVC web site with it.
What would you suggest when it comes to building the web site ( this would be just a basic site with different sections to understand controllers/actions/ids )? I know that PureMVC is a fairly well established framework, but in this case how (if) could it be implemented?
I'm hoping for something along the lines of ASP.NET MVC, which I've breifly had a look at, but not had time to use properly.
Many thanks for any advice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Haxe 对此很有好处,因为 MVC 对于 OO 来说非常自然(不像 PHP 那样具有对象能力)。
请记住,MVC 更多的是一个概念,因此它的实现方式非常一般,取决于您。
要记住的事情。
Haxe 有单个入口点,这意味着您的所有 url 都必须指向某个具有“主”类/函数的 haxe(php) 文件。 (你必须制作一个简单的 .htaccess 它将所有网址重新指向这个“main”函数)
旁注:您可以将每个文件编译为单独的应用程序,例如 php,但我不推荐。
这个入口点最终应该初始化一些类,我们将其称为调度程序。
所谓的调度程序将识别 url/uri
php.Web.getURI()
并基于此将启动适当的类/函数,并且可能还包含来自 url 的一些参数。另一件要记住的事情是,您不能编写意大利面条般的代码(类似 PHP)。
您必须使用某种模板引擎或自己编写一个简单的模板引擎。
Haxe 有两个模板引擎,一个是 haxe.template(非常简单),另一个是 Templo(非常不错且功能强大)。
考虑到这一点,您应该能够开始解决这个问题;]
Haxe is good for it cause MVC is very natural for OO(not object capable alike PHP).
Keep in mind MVC is more of a concept, so it very general the way its implemented is up to you.
Things to remember.
Haxe has single entry point, meaning all your urls have to be pointed to a certain haxe(php) file which has "main" class/function. (You have to make a simple .htaccess which would repoint all urls to this "main" function)
Side notes: you can compile each file to be separate app kind'a like php but I would not recomended.
This entry point should eventually initilize some class let's call it a dispatcher.
So called dispatcher will identify the url/uri
php.Web.getURI()
and based on that will fire up apriopriate class/function and perhaps with some parameters from url.Another thing to remember is that you cannot do code spaghetti (a'la PHP).
You have to use some sort of templating enginge or write a simple one yourself.
Haxe has two template engines one is
haxe.template
(very simple) and another one is Templo (very decent and powerful).With that in mind you should be able to start cracking the subject ;]
HaQuery 是一个新的 Haxe Web 框架。有关详细信息,您可以查看http://haquery.com/。
HaQuery is a new Haxe web framework. For details, you may look to http://haquery.com/.
在客户端使用 Haxe 将使您完全无需在服务器端构建 HTML。
您的客户端可以从简单的 REST Web 服务获取所有数据,并在浏览器中完成所有 UI 工作。非常高效且可扩展。
如果您熟悉的话,您甚至可以用 haxe 编写这些 REST Web 服务: http://www.haxenode.org /
Using Haxe on the client side should free you from the need to build HTML on the server side at all.
Your client could get all its data from simple REST web services and do all the UI work in the browser. Very efficient and scalable.
You could even write those REST web services in haxe if that is what you are familiar with: http://www.haxenode.org/