Re: vibed: how to use pure HTML instead of template engine?

2015-05-08 Thread Rikki Cattermole via Digitalmars-d-learn
On 8/05/2015 10:17 p.m., Chris wrote: On Thursday, 7 May 2015 at 19:51:20 UTC, yawniek wrote: On Thursday, 7 May 2015 at 18:59:13 UTC, Suliman wrote: 1. Do I need write ./public/ ? In examples often simply public/ will work too. even public it goes trough Path struct, see:

Re: vibed: how to use pure HTML instead of template engine?

2015-05-08 Thread Chris via Digitalmars-d-learn
On Friday, 8 May 2015 at 10:20:35 UTC, Rikki Cattermole wrote: On 8/05/2015 10:17 p.m., Chris wrote: On Thursday, 7 May 2015 at 19:51:20 UTC, yawniek wrote: On Thursday, 7 May 2015 at 18:59:13 UTC, Suliman wrote: 1. Do I need write ./public/ ? In examples often simply public/ will work too.

Re: vibed: how to use pure HTML instead of template engine?

2015-05-08 Thread Chris via Digitalmars-d-learn
On Thursday, 7 May 2015 at 19:51:20 UTC, yawniek wrote: On Thursday, 7 May 2015 at 18:59:13 UTC, Suliman wrote: 1. Do I need write ./public/ ? In examples often simply public/ will work too. even public it goes trough Path struct, see:

Re: vibed: how to use pure HTML instead of template engine?

2015-05-08 Thread Rikki Cattermole via Digitalmars-d-learn
On 8/05/2015 10:49 p.m., Chris wrote: On Friday, 8 May 2015 at 10:20:35 UTC, Rikki Cattermole wrote: On 8/05/2015 10:17 p.m., Chris wrote: On Thursday, 7 May 2015 at 19:51:20 UTC, yawniek wrote: On Thursday, 7 May 2015 at 18:59:13 UTC, Suliman wrote: 1. Do I need write ./public/ ? In

Re: vibed: how to use pure HTML instead of template engine?

2015-05-07 Thread Chris via Digitalmars-d-learn
On Thursday, 7 May 2015 at 09:27:39 UTC, Chris wrote: On Thursday, 7 May 2015 at 08:25:30 UTC, Suliman wrote: You're not setting a port. add: settings.port = 8080; before listenHTTP(); then it'll work. It's do not help :( This should work, put it in your `app.d` file: import vibe.d;

Re: vibed: how to use pure HTML instead of template engine?

2015-05-07 Thread Suliman via Digitalmars-d-learn
Is next example is enough to serv simple index.html page? void setupServer() { auto router = new URLRouter; // add other routes here router.get(*, serveStaticFiles(public/)); auto settings = new HTTPServerSettings; listenHTTP(settings, router); } After

Re: vibed: how to use pure HTML instead of template engine?

2015-05-07 Thread Suliman via Digitalmars-d-learn
You're not setting a port. add: settings.port = 8080; before listenHTTP(); then it'll work. It's do not help :(

Re: vibed: how to use pure HTML instead of template engine?

2015-05-07 Thread wobbles via Digitalmars-d-learn
On Thursday, 7 May 2015 at 08:25:30 UTC, Suliman wrote: You're not setting a port. add: settings.port = 8080; before listenHTTP(); then it'll work. It's do not help :( You're sure? My app.d is: import std.stdio; import vibe.d; shared static this(){ auto router = new URLRouter;

Re: vibed: how to use pure HTML instead of template engine?

2015-05-07 Thread wobbles via Digitalmars-d-learn
On Thursday, 7 May 2015 at 09:08:53 UTC, wobbles wrote: On Thursday, 7 May 2015 at 08:25:30 UTC, Suliman wrote: You're not setting a port. add: settings.port = 8080; before listenHTTP(); then it'll work. It's do not help :( You're sure? My app.d is: import std.stdio; import vibe.d;

Re: vibed: how to use pure HTML instead of template engine?

2015-05-07 Thread Chris via Digitalmars-d-learn
On Thursday, 7 May 2015 at 08:25:30 UTC, Suliman wrote: You're not setting a port. add: settings.port = 8080; before listenHTTP(); then it'll work. It's do not help :( This should work, put it in your `app.d` file: import vibe.d; shared static this() { auto settings = new

Re: vibed: how to use pure HTML instead of template engine?

2015-05-07 Thread wobbles via Digitalmars-d-learn
On Thursday, 7 May 2015 at 08:09:50 UTC, Suliman wrote: Is next example is enough to serv simple index.html page? void setupServer() { auto router = new URLRouter; // add other routes here router.get(*, serveStaticFiles(public/)); auto settings = new

Re: vibed: how to use pure HTML instead of template engine?

2015-05-07 Thread yawniek via Digitalmars-d-learn
On Thursday, 7 May 2015 at 18:59:13 UTC, Suliman wrote: 1. Do I need write ./public/ ? In examples often simply public/ will work too. even public it goes trough Path struct, see: https://github.com/rejectedsoftware/vibe.d/blob/11578aa956a9b3b0e305d655f9668a867fdd89bd/source/vibe/inet/path.d

Re: vibed: how to use pure HTML instead of template engine?

2015-05-07 Thread Suliman via Digitalmars-d-learn
shared static this() { auto router = new URLRouter; router.get(/, root); auto settings = new HTTPServerSettings; settings.port = 8080; listenHTTP(settings, router); } void root(HTTPServerRequest req, HTTPServerResponse res) { serveStaticFiles(public/); }

Re: vibed: how to use pure HTML instead of template engine?

2015-05-07 Thread yawniek via Digitalmars-d-learn
On Thursday, 7 May 2015 at 18:59:13 UTC, Suliman wrote: shared static this() { auto router = new URLRouter; router.get(/, root); auto settings = new HTTPServerSettings; settings.port = 8080; listenHTTP(settings, router); } void root(HTTPServerRequest req,

Re: vibed: how to use pure HTML instead of template engine?

2015-05-07 Thread Chris via Digitalmars-d-learn
Later you can have more sophisticated methods, e.g. if you want to handle query strings you could do something like this: import vibe.d; shared static this() { auto settings = new HTTPServerSettings; settings.port = 8080; settings.bindAddresses = [::1, 127.0.0.1]; auto router = new

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Chris via Digitalmars-d-learn
On Wednesday, 6 May 2015 at 13:32:48 UTC, Suliman wrote: By default vibed use Diet. Maybe it's cool, but for me it's easier to write in pure HTML. What is the best way to do it? You want to serve html files instead of templates, right? It should be something like router.get(*,

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Chris via Digitalmars-d-learn
On Wednesday, 6 May 2015 at 13:50:04 UTC, Chris wrote: On Wednesday, 6 May 2015 at 13:32:48 UTC, Suliman wrote: By default vibed use Diet. Maybe it's cool, but for me it's easier to write in pure HTML. What is the best way to do it? You want to serve html files instead of templates, right? It

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Suliman via Digitalmars-d-learn
I mean that I know that template can be changes dynamically, but I thought that 99% of dynamic is javascript code...

vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Suliman via Digitalmars-d-learn
By default vibed use Diet. Maybe it's cool, but for me it's easier to write in pure HTML. What is the best way to do it?

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Suliman via Digitalmars-d-learn
You want to serve html files instead of templates, right? It should be something like Yeah, I do not see any profits with using templates right now. Explain me if I am wrong.

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Alex Parrill via Digitalmars-d-learn
On Wednesday, 6 May 2015 at 14:07:09 UTC, Suliman wrote: I mean that I know that template can be changes dynamically, but I thought that 99% of dynamic is javascript code... What if the user has Javascript disabled, or is using some client that doesn't execute Javascript (spiders and

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Andrea Fontana via Digitalmars-d-learn
On Wednesday, 6 May 2015 at 14:28:26 UTC, Adam D. Ruppe wrote: On Wednesday, 6 May 2015 at 14:23:27 UTC, Chris wrote: Especially this: http://vibed.org/templates/diet#embedded-code I think that's a misfeature... if I used vibe.d, I'd want to avoid the diet too. I agree

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Chris via Digitalmars-d-learn
On Wednesday, 6 May 2015 at 14:28:26 UTC, Adam D. Ruppe wrote: On Wednesday, 6 May 2015 at 14:23:27 UTC, Chris wrote: Especially this: http://vibed.org/templates/diet#embedded-code I think that's a misfeature... if I used vibe.d, I'd want to avoid the diet too. I have never used the

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Chris via Digitalmars-d-learn
On Wednesday, 6 May 2015 at 14:21:24 UTC, Chris wrote: On Wednesday, 6 May 2015 at 14:07:09 UTC, Suliman wrote: I mean that I know that template can be changes dynamically, but I thought that 99% of dynamic is javascript code... Templates are like PHP, JSP, LSP etc. They can do stuff on the

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Chris via Digitalmars-d-learn
On Wednesday, 6 May 2015 at 14:07:09 UTC, Suliman wrote: I mean that I know that template can be changes dynamically, but I thought that 99% of dynamic is javascript code... Templates are like PHP, JSP, LSP etc. They can do stuff on the server side via embedded D code, load files for example.

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 6 May 2015 at 14:23:27 UTC, Chris wrote: Especially this: http://vibed.org/templates/diet#embedded-code I think that's a misfeature... if I used vibe.d, I'd want to avoid the diet too.

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Adam D. Ruppe via Digitalmars-d-learn
You can put that dynamic data in regular HTML too as long as you generate it on the server. I imagine vibe.d must support some kind of raw output write function, if you find that, you can make your html then just write it out as a string.

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Dicebot via Digitalmars-d-learn
On Wednesday, 6 May 2015 at 20:45:10 UTC, John Colvin wrote: On Wednesday, 6 May 2015 at 14:28:26 UTC, Adam D. Ruppe wrote: On Wednesday, 6 May 2015 at 14:23:27 UTC, Chris wrote: Especially this: http://vibed.org/templates/diet#embedded-code I think that's a misfeature... if I used vibe.d,

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 6 May 2015 at 14:28:26 UTC, Adam D. Ruppe wrote: On Wednesday, 6 May 2015 at 14:23:27 UTC, Chris wrote: Especially this: http://vibed.org/templates/diet#embedded-code I think that's a misfeature... if I used vibe.d, I'd want to avoid the diet too. I quite like them. Obviously

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Suliman via Digitalmars-d-learn
auto html = someStringActions(); res.writeBody(cast(ubyte[])html); Thanks, but how to attach to html css file? Now page is loading, but do not handle css that also placed in this folder.

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Suliman via Digitalmars-d-learn
And how people write in jade if it's impossible to preview page without compiling it's to HTML?

Re: vibed: how to use pure HTML instead of template engine?

2015-05-06 Thread Chris via Digitalmars-d-learn
On Wednesday, 6 May 2015 at 18:52:41 UTC, Suliman wrote: auto html = someStringActions(); res.writeBody(cast(ubyte[])html); Thanks, but how to attach to html css file? Now page is loading, but do not handle css that also placed in this folder. CSS should be exported automatically when you