Opa (programming language): Difference between revisions

Content deleted Content added
No edit summary
Tags: Mobile edit Mobile web edit
Examples: The Wikipedia is not a GUIDE or TEXTBOOK.
Tag: section blanking
Line 36:
The 0.9.0 release in February 2012 introduced database mapping technology for the non-relational, document-oriented database [[MongoDB]], similar to [[object-relational mapping]].<ref>{{cite web|url=http://doc.opalang.org/#!/manual/Hello--database|title=Hello, database|publisher=Opa Documentation|access-date=2012-02-22|archive-url=https://web.archive.org/web/20140112111933/http://doc.opalang.org/#!/manual/Hello--database|archive-date=2014-01-12|url-status=dead}}</ref><ref>{{cite web|url=http://doc.opalang.org/#!/manual/Low-level-MongoDB-support|title=Low-level MongoDB support|publisher=Opa Documentation|access-date=2012-02-22|archive-url=https://web.archive.org/web/20140112111933/http://doc.opalang.org/#!/manual/Low-level-MongoDB-support|archive-date=2014-01-12|url-status=dead}}</ref><ref>{{cite news|url=http://news.idg.no/cw/art.cfm?id=36C6A408-F2EE-3929-CB53260EBA6B884F|title=Programming Opa: Web development, reimagined|publisher=[[Computerworld]]|date=1 February 2012}}</ref>
The 1.1.0 release in February 2013 also added support for [[PostgreSQL]], paving the way for the support of several [[SQL]] databases.
 
== Examples ==
 
=== Hello world ===
The traditional [["Hello, World!" program]], producing a web server that serves a static page with "Hello, web!" as its content, can be written in Opa as:<ref>{{cite web |url=http://www.morganhill.co.uk/cloud/opa-the-cloud-language-test-drive/ |title=Opa, the cloud language – a test drive |date=26 July 2011 |publisher=Morgan Hill |last1=Aitken |first1=Alastair |access-date=6 September 2011 |archive-url=https://web.archive.org/web/20110925044819/http://www.morganhill.co.uk/cloud/opa-the-cloud-language-test-drive/ |archive-date=25 September 2011 |url-status=dead}}</ref>
 
<syntaxhighlight lang="opa">
Server.start(Server.http,
{ title: "Hello"
, page: function() { <h1>Hello, web!</h1> }
}
)
</syntaxhighlight>
 
It can be compiled to a stand-alone executable JavaScript file with:
<syntaxhighlight lang="bash">
$ opa hello_web.opa
</syntaxhighlight>
 
Running the resulting executable JavaScript file launches the web application:
<syntaxhighlight lang="bash">
$ ./hello_web.js
</syntaxhighlight>
 
== See also ==