vibe.d-example illustrating Dynamic Textual Web-Interface

Sebastiaan Koppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Nov 30 12:05:41 PST 2015


On Monday, 30 November 2015 at 10:08:17 UTC, Nordlöw wrote:
> Can somebody please show a enlightening example of, so called,
>
> "revamp of the REST interface generator"
>
> added to release 0.7.26 at:
>
> http://vibed.org/blog/posts/vibe-release-0.7.26
>
> I want to use vibe.d to add a modern dynamic web-interface to 
> my knowledge graph I'm currently developing.
>
> More specifically I would like an interface that makes rich use 
> of dynamic HTML. When the user changes the contents of a 
> search/command-line text-field the client logic shall on the 
> fly (after a certain delay) lookup related information with 
> vibe.d-server and present the user with relevant hits or 
> completions in a another part of page (HTML div-block).
>
> Does anybody have a similar vibe.d-project to be inspired from, 
> in this regard?

I have written a mpd (Music Player Daemon) client in D and just 
finished the web app (bar a couple of features).

All of the rendering is done on the client and only json data is 
transmitted between server and web app. Just finished the 
WebSocket part so if anybody changes the music/volume/playlist, 
all clients update the interface.

The code could use a cleanup/refactoring but everything is 
working.

The D parts of interest are the MpdApiInterface1 and MpdApi1 
classes in source/app.d

For the JS parts you can start with source/index.js, but its full 
of ES6 classes and react code. So that might not be your cup of 
tea. In index.js there are mainly React Classes (basically html 
renderers) and React Container Classes (basically code handling 
input changes).

In the source/actions folder there are some js files that call 
the server and modify state (volume/song). In the source/stores 
folder, some js files that only retrieve data.

The js architecture if influenced by react/flux/facebook's, but I 
am toying with it to see what fits for me. Specifically I rely a 
lot on RxJS for the observables.

For the project I decided to put js and d files in the same 
folders. That might not have been a good idea. Also dub has some 
issues with one of the D dependencies that I haven't updated in 
months.

Code can be found here: https://bitbucket.org/skoppe/mpc/src


More information about the Digitalmars-d-learn mailing list