Added a template section to the readme

ref #6
This commit is contained in:
Nicolai Ort 2021-02-02 14:48:27 +01:00
parent 56b72275ac
commit 8141269dd9
1 changed files with 21 additions and 0 deletions

View File

@ -1,6 +1,8 @@
# @lfk/document-server
The document generation server responsible for creating pdfs for sponsoring contracts, certificates and more.
This server doesn't interact with any database and can therefor be deployed on it's own.
The basic generation mechanism makes the templates and routes interchangeable (if you want to expand or modify it).
## Quickstart 🐳
> Use this to run the document server in docker.
@ -30,6 +32,25 @@ The document generation server responsible for creating pdfs for sponsoring cont
| APP_PORT | Number | 4010 | The port the backend server listens on. Is optional.
| NODE_ENV | String | dev | The apps env - influences debug info.
## Templates
> The document server uses html templates to generate various pdf documents.
> The templates are stored in src/templates by default.
We provide a set of default templates that we uses for the ["Lauf für Kaya!" charity run](https://lauf-fuer-kaya.de).
We use mustache-style templating strings to fill the templates with real information (exact strings are explained below).
You can provide your own templates by replaceing the ones we provided before compiling the project or by simply mounting your custom templates into the docker container.
The server currently needs the following templates to work:
* sponsoring_contract.html
### Sponsoring Contracts
|Template String | Type | Optional | Description
| runner_firstname | string | ❌ | The runner's first name
| runner_middlename | string | ✅ | The runner's middle name
| runner_lastname | string | ❌ | The runner's last name
| runner_id | int | ❌ | The runner's id
## Recommended Editor
[Visual Studio Code](https://code.visualstudio.com/)