digitalmars.D.learn - vibe / self contained standalone executable?
- =?iso-8859-1?Q?Robert_M._M=FCnch?= (8/8) Jul 28 2019 Is it possible to pack a complete "web-app" (serving web-pages and
- Sebastiaan Koppe (4/8) Jul 28 2019 I am using
- bauss (4/13) Jul 28 2019 It works on anything since it just loads in the data (as text I
- =?iso-8859-1?Q?Robert_M._M=FCnch?= (7/9) Jul 28 2019 And this works than good together with the vibe framework? So, it's not
- rikki cattermole (4/12) Jul 28 2019 vibe.d uses this for their templates.
- Sebastiaan Koppe (23/29) Jul 28 2019 Haven't tested it, but something like this:
- bauss (4/35) Jul 28 2019 Doing it like that is kinda pointless though because you can just
Is it possible to pack a complete "web-app" (serving web-pages and providing REST API) into a single executable so that no other files need to be accessed and everything is servered from something like a "virtual filesystem" which is in memory only? -- Robert M. Münch http://www.saphirion.com smarter | better | faster
Jul 28 2019
On Sunday, 28 July 2019 at 13:45:50 UTC, Robert M. Münch wrote:Is it possible to pack a complete "web-app" (serving web-pages and providing REST API) into a single executable so that no other files need to be accessed and everything is servered from something like a "virtual filesystem" which is in memory only?I am using https://dlang.org/spec/expression.html#import_expressions for text files. Don't know if it works on binary files as well.
Jul 28 2019
On Sunday, 28 July 2019 at 14:14:06 UTC, Sebastiaan Koppe wrote:On Sunday, 28 July 2019 at 13:45:50 UTC, Robert M. Münch wrote:It works on anything since it just loads in the data (as text I think?) from the file. But you can just convert it to a buffer etc.Is it possible to pack a complete "web-app" (serving web-pages and providing REST API) into a single executable so that no other files need to be accessed and everything is servered from something like a "virtual filesystem" which is in memory only?I am using https://dlang.org/spec/expression.html#import_expressions for text files. Don't know if it works on binary files as well.
Jul 28 2019
On 2019-07-28 14:14:06 +0000, Sebastiaan Koppe said:I am using https://dlang.org/spec/expression.html#import_expressions for text files. Don't know if it works on binary files as well.And this works than good together with the vibe framework? So, it's not requiring or forcing one to use files or databases? -- Robert M. Münch http://www.saphirion.com smarter | better | faster
Jul 28 2019
On 29/07/2019 2:42 AM, Robert M. Münch wrote:On 2019-07-28 14:14:06 +0000, Sebastiaan Koppe said:vibe.d uses this for their templates. For a VFS you would need to have your own API (can be library) that you explicitly use.I am using https://dlang.org/spec/expression.html#import_expressions for text files. Don't know if it works on binary files as well.And this works than good together with the vibe framework? So, it's not requiring or forcing one to use files or databases?
Jul 28 2019
On Sunday, 28 July 2019 at 14:42:48 UTC, Robert M. Münch wrote:On 2019-07-28 14:14:06 +0000, Sebastiaan Koppe said:Haven't tested it, but something like this: --- import vibe.core.core : runApplication; import vibe.http.server; void handleRequest(scope HTTPServerRequest req, scope HTTPServerResponse res) { if (req.path == "/file.txt") res.writeBody(import("file.txt"), "text/plain"); } void main() { auto settings = new HTTPServerSettings; settings.port = 8080; settings.bindAddresses = ["::1", "127.0.0.1"]; auto l = listenHTTP(settings, &handleRequest); scope (exit) l.stopListening(); runApplication(); } --- Of course you may want to use the router or the rest generator for this. See the examples in the repo.I am using https://dlang.org/spec/expression.html#import_expressions for text files. Don't know if it works on binary files as well.And this works than good together with the vibe framework? So, it's not requiring or forcing one to use files or databases?
Jul 28 2019
On Sunday, 28 July 2019 at 18:54:37 UTC, Sebastiaan Koppe wrote:On Sunday, 28 July 2019 at 14:42:48 UTC, Robert M. Münch wrote:Doing it like that is kinda pointless though because you can just serve static files. http://vibed.org/api/vibe.http.fileserver/serveStaticFilesOn 2019-07-28 14:14:06 +0000, Sebastiaan Koppe said:Haven't tested it, but something like this: --- import vibe.core.core : runApplication; import vibe.http.server; void handleRequest(scope HTTPServerRequest req, scope HTTPServerResponse res) { if (req.path == "/file.txt") res.writeBody(import("file.txt"), "text/plain"); } void main() { auto settings = new HTTPServerSettings; settings.port = 8080; settings.bindAddresses = ["::1", "127.0.0.1"]; auto l = listenHTTP(settings, &handleRequest); scope (exit) l.stopListening(); runApplication(); } --- Of course you may want to use the router or the rest generator for this. See the examples in the repo.I am using https://dlang.org/spec/expression.html#import_expressions for text files. Don't know if it works on binary files as well.And this works than good together with the vibe framework? So, it's not requiring or forcing one to use files or databases?
Jul 28 2019