tex: add more stuff on app architecture
This commit is contained in:
parent
888d85e0e7
commit
4794060cd0
33
tex/text.tex
33
tex/text.tex
@ -815,8 +815,37 @@ similar applies to the database client. These are passed around as a pointer,
|
|||||||
so the underlying data stays the same. As a rule of thumb, every larger
|
so the underlying data stays the same. As a rule of thumb, every larger
|
||||||
\texttt{struct} that needs to be passed around is passed around as a pointer.
|
\texttt{struct} that needs to be passed around is passed around as a pointer.
|
||||||
|
|
||||||
Authentication logic is relatively simple and the author would like to isolate
|
The authentication logic is relatively simple and the author would like to
|
||||||
it into a custom \emph{middleware} but that is a future work.
|
isolate it into a custom \emph{middleware}.
|
||||||
|
|
||||||
|
An important thing to mention is embedded assets and templates. Go has multiple
|
||||||
|
mechanisms to natively embed arbitrary files directly into the binary during
|
||||||
|
the regular build process. A built-in \texttt{embed} package was used to bundle
|
||||||
|
all template files and web assets, such as images, logos and stylesheets at the
|
||||||
|
package level, and these are also the passed around the application as needed.
|
||||||
|
There is also a toggle in the application configuration, which can instruct the
|
||||||
|
program at start to either rely entirely on embedded assets or pull live files
|
||||||
|
from the filesystem. The former option makes the application more portable,
|
||||||
|
while the latter allows for flexibility not only during development. Basically
|
||||||
|
any important value in the program has been made into a configuration value, so
|
||||||
|
that the operator can customise the experience as needed. Sane configuration
|
||||||
|
details were chosen, which results in the configuration file from essentially
|
||||||
|
only containing secrets.
|
||||||
|
|
||||||
|
Templates used for rendering of the web pages are created in a composable
|
||||||
|
manner and split into smaller, reusable parts, such as \texttt{footer.tmpl} and
|
||||||
|
\texttt{head.tmpl}. An Echo renderer interface has been implemented, so that
|
||||||
|
the rendering can be performed ergonomically and directly using Echo's built-in
|
||||||
|
facilities. The application constructs the web pages entirely server-side and
|
||||||
|
it runs without a single line of JavaScript, of which the author is especially
|
||||||
|
proud. It improves load times, decreases attack surface, increases
|
||||||
|
maintainability and reduces cognitive load that is required when dealing with
|
||||||
|
JavaScript. Of course that requires extensive usage of \texttt{POST}s in forms
|
||||||
|
and frequent full-page refreshes, but that still is not enough to warrant the
|
||||||
|
use of JavaScript.
|
||||||
|
|
||||||
|
The author experimented with WebAssembly though, but has ultimately scrapped
|
||||||
|
the functionality in favour of the entirely server-side rendered.
|
||||||
|
|
||||||
|
|
||||||
\n{1}{Implementation}
|
\n{1}{Implementation}
|
||||||
|
Reference in New Issue
Block a user