[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Web development
From: |
Ricardo Wurmus |
Subject: |
Re: Web development |
Date: |
Fri, 04 Sep 2020 18:44:46 +0200 |
User-agent: |
mu4e 1.4.13; emacs 27.1 |
Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> writes:
> So I have a few questions:
>
> (1) How do you do your Guile web development? What's the setup?
I don’t use a framework in my web projects; just the included web
modules and sometimes the fibers web server. I keep everything
stateless so that I can spin up many workers (i.e. Guile processes
with a web server listening on one of a range of local ports) and
dispatch to them from a reverse proxy such as Nginx or Lighttpd.
> (2) What do you use to serve static files (securely)? If you use Guile's
> web server, how exactly do you do it? Do you have the code somewhere?
I configure an assets directory and define a procedure that sanitizes
the requested file name to serve it from that directory. I don’t do
much with files so I don’t usually do anything other than
(call-with-input-file file-name get-bytevector-all)
for the body of the response. But if I had to send large files I’d use
“sendfile” directly.
> (3) Perhaps there is a minimalistic option instead of NGINX or HAProxy
> out there, which is also free software? Is there perhaps even anything
> in Guile, which I could use, that is suitable for serving static files?
Lighttpd seems to be lighter than Nginx. If all you want is serve
static files upon request I’d use just Guile, matching on the request,
looking up the file in a declared directory, and using sendfile to push
it to the requester.
--
Ricardo