www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Potcake Web Framework v0.2.0

I've been working on implementing some of the things I like about 
the Django framework from Python in D. It started out as a vibe.d 
router implementing Django's URL dispatching scheme 
(https://forum.dlang.org/thread/mhnchxsabvvriavwqntj forum.dlang.org). Now it's
a web framework of its own (still powered by vibe.d):

The latest release is setup for easy web app creation. Web apps 
can be created through two new objects, `WebApp` and 
`WebAppSettings`. Through them we provide the following features:
- [Django-style 
- [Static file 
(with collection of files from multiple directories)
- [Django-style URL 
- [Middleware](https://github.com/kyleingraham/potcake#middleware)
- [Settings 

The URL dispatching has been revamped to provide an ergonomic API 
free of templates. Path parsing is now done at runtime which 
frees us from the struggles templates bring. Templates are great 
but use of them for central data structures forces user code to 
be templated. It also makes some API structures impossible to 
right. For example, with templates the user cannot store 
configuration as data prior to instantiating the WebApp if the 
configuration uses templates that need the WebApp. Also, each 
instantiation is a new type if the template arguments differ. 
This prevents storing template instantiations in a collection. 
Instead we make heavy use of delegates for storing code to use an 
object instead of objects themselves. This is handy for storing 
disparate objects in a collection when they all are alike in the 
actions carried out using them.

There are 
[examples](https://github.com/kyleingraham/potcake#examples) as 
well if you'd like to see super-simple apps demonstrating the 
framework's features.

There isn't much documentation in the code yet but the README 
covers what's available.

I would love to one day duplicate Django's application concept 
where libraries specifically made for Django can ship templates, 
static files, and code that is easy to integrate in a Django 
project. Part of what's needed is there with collecting static 
files from multiple directories but there's still lots of ground 
to cover.
Jul 15