Dangular - D Rest server + Angular frontend

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jul 19 12:54:29 PDT 2015


Hi

I have created a personal project that aims to learn myself more 
about D/vibe.d and to create a simple and easy to grasp example 
on Mongo -> Vibe -> Angular.

I have been thinking about the possibility of embedding D code in 
diet templates, as for ex to set api urls. Right now the urls are 
statically defined in the diet template. Other than that the 
example app is really not the best example with Angular because 
it uses root events to signal between controllers, but it works 
as a bootstrap example. I am thinking to create another view that 
uses ReactJS because its much much more better than Angular.

Project is located here:

https://github.com/jarlah/dangular

Any comments are appreciated. Especially about the D part, 
because the Angular part is really just to make it easier for me 
to test, and it took like half an hour or hour to trash up (not 
using angular on daily basis)...

I want to especially note a problem i have in the D code. Its 
about deserializing json data for creating a new person. I cant 
use the same struct for creating a new person as for returning a 
list of or a single person, because i want to return the ObjectID 
when I am querying mongo. I thhink the conversion from Document 
to PersonDoc is an operation that ensures that i am only 
returning explicitly what I really want to return. Any excess 
data in the collection is discarded. Nice for example to hide 
extra details for normal users, for ex.

So, there is two structs, but I really only want to have one. 
Should I use classes for this? Inheritance?


More information about the Digitalmars-d-learn mailing list