From c39fc9861b47d03e4ed5b536264cd6edd7442df4 Mon Sep 17 00:00:00 2001
From: Christian Boettcher <c.boettcher@fz-juelich.de>
Date: Thu, 27 May 2021 14:25:56 +0200
Subject: [PATCH] add frontend description ot the readme it's as incomplete as
 the frontend itself

---
 README.md                | 17 +++++++++++++++++
 frontend/createStatic.py |  4 ++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index a63d73b..67eb3c4 100644
--- a/README.md
+++ b/README.md
@@ -5,6 +5,23 @@ This is Data Catalog for eFlows4HPC project
 Find architecture in [arch](arch/arch.adoc) folder. 
 
 
+## Frontend Server for the Data Catalog
+
+[This](frontend/) part is the frontend for the Data Catalog. It will be the user interface, so that no one is forced to manually do http calls to the api. Since the content is managed by the [api-server}(apiserver/), this can be deployed as a static website, containing only html, css and javascript. To make the different pages more uniform and avoid duplicate code, the static pages will be generated by the [jinja2](https://jinja.palletsprojects.com/en/3.0.x/templates/) template engine.
+
+To compile the static pages to the `./site/` directory (will be created if required), simply run 
+```bash
+pip install -r requirements.txt
+python frontend/createStatic.py
+```
+
+The site can then be deployed to any webserver that is capable of serving files, as no other server functionality is strictly required. However, in a proper deployment, access and certificates should be considered.
+
+For development (and only for development), an easy way to deploay a local server is
+```shell
+python -m http.server <localport> --directory site/
+```
+
 ## API-Server for the Data Catalog
 
 [This](apiserver/) part is the the API-server for the Data Catalog, which will provide the backend functionality.
diff --git a/frontend/createStatic.py b/frontend/createStatic.py
index f997f3a..0a381a2 100644
--- a/frontend/createStatic.py
+++ b/frontend/createStatic.py
@@ -2,7 +2,7 @@ from jinja2 import Environment, FileSystemLoader
 import os
 import shutil
 
-def main():
+def render_template_to_site():
     ## copy javascript files to site folder
     src_files = os.listdir('frontend/js')
     dest = 'site/js'
@@ -43,4 +43,4 @@ def main():
             f.write(html[file])
 
 if __name__ == "__main__":
-    main()
\ No newline at end of file
+    render_template_to_site()
\ No newline at end of file
-- 
GitLab