|
Revision 264, 0.5 kB
(checked in by BCS, 4 years ago)
|
I have gone over to the dark side; I have created an AJAX web app framework. It lets you use AJAXy stuff to, from the client, access a JS proxy to a D object on the server. (and it's all templates ;-)
|
| Line | |
|---|
| 1 |
import cgi.cgi; |
|---|
| 2 |
import bottledAJAX; |
|---|
| 3 |
|
|---|
| 4 |
void main(char[][] argv) |
|---|
| 5 |
{ |
|---|
| 6 |
static const char[] code = ClientCode!(Foo,"/cgi-bin/"~__FILE__[0..$-2], "bar","pig", "cat"); |
|---|
| 7 |
CGI cgi = new TextCGI(argv); |
|---|
| 8 |
|
|---|
| 9 |
if("" == cgi.Value("classname")) |
|---|
| 10 |
cgi.writef("%s", code); |
|---|
| 11 |
else |
|---|
| 12 |
Process!(Foo, "bar", "pig", "cat")(cgi,new Foo); |
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
pragma(msg, \n~ code ~\n); |
|---|
| 16 |
} |
|---|
| 17 |
class Foo{ |
|---|
| 18 |
|
|---|
| 19 |
int bar(int i, char[] j) |
|---|
| 20 |
{ |
|---|
| 21 |
debug cgi_.writef("%d, %s\n", i, j); |
|---|
| 22 |
return i + j.length; |
|---|
| 23 |
} |
|---|
| 24 |
char[] pig(float f) { return "hello"; } |
|---|
| 25 |
|
|---|
| 26 |
char[] cat(char[] a, char[] b){return a~b;} |
|---|
| 27 |
} |
|---|