Diamond MVC
| Original author(s) | Jacob Jensen |
|---|---|
| Developer(s) | Jacob Jensen / bausshf |
| Initial release | May 17, 2016 |
| Stable release | 2.4.6
/ November 6, 2017 |
| Written in | D language |
| Engine | |
| Operating system | Cross-platform |
| Type | Web framework,Model-view-controller,Web template system |
| License | MIT License |
| Website | [1] |
Search Diamond MVC on Amazon.
Diamond is an open-source software web framework and web template system originally built as an alternative to Diet templates in vibe.d; however, it now has standalone support, but still uses vibe.d for its web support. It is heavily inspired by ASP.NET Razor for its template syntax, as well as the model-view-controller implementation. Diamond is written entirely in the D programming language.
Features
Performance
Diamond has exceptional performance because it processes its templates at compile time and thus does not have to do much parsing on each request. At the same time, it depends on vibe.d as its web backend, which itself is a powerful engine.
MVC (Model-view-controller)
Diamond primarily uses the model-view-controller pattern for processing. However, using the model-view-controller pattern isn't required and is completely optional.
Syntax
The syntax of Diamond is heavily inspired by ASP.NET Razor, but still differs and has its own set of rules.
Below is an example of a simple view with a layout, displaying the syntax of Diamond templates.
Layout.dd:
@<doctype>
<html>
<head>
<title>@<title></title>
</head>
<body>
@<view>
</body>
</html>Home.dd:
@[
layout:
layout
---
controller:
HomeController
---
model:
Home
---
route:
home
---
placeHolders:
[
"title": "Home"
]
]
@:import std.datetime : Clock;
The time is: <b>@=Clock.currTime();</b>
@:if (model) {
<span>Passed a model with: @=model.foo;</span>
}
@:else {
<span>Passed no model.</span>
}Authentication
Diamond supports a very flexible integration of authentication with roles.
ACL
Diamond has ACL built-in with an easy API that can be used along with its built-in authentication.
RESTful
Combined with the ACL, Diamond has the possibility to be completely RESTful.
Cookies/Sessions
Diamond implements an easy-to-use cookie/session API.
Network Restrictions
The applications written in Diamond can be restricted to specific networks, either globally or per controller actions.
Unittesting
Unit testing is built-in and can easily be integrated with applications using Diamond.
Object-relational-mapping
Diamond supports object-relational-mapping, easily integrated with its MySql engine.
See also
References
External links
This article "Diamond MVC" is from Wikipedia. The list of its authors can be seen in its historical. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.
