Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tough-dev-school/diploma-generator
Micro service for generating student certificates out of SVG-templates
https://github.com/tough-dev-school/diploma-generator
express nodejs puppeteer
Last synced: 2 months ago
JSON representation
Micro service for generating student certificates out of SVG-templates
- Host: GitHub
- URL: https://github.com/tough-dev-school/diploma-generator
- Owner: tough-dev-school
- Created: 2021-09-13T13:24:15.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-10-24T17:27:02.000Z (3 months ago)
- Last Synced: 2024-10-26T01:24:21.376Z (3 months ago)
- Topics: express, nodejs, puppeteer
- Language: JavaScript
- Homepage:
- Size: 44.5 MB
- Stars: 13
- Watchers: 0
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Diploma generator
Render bundled SVG templates to PNG images, return them by HTTP, using
GET query string as template context.## Installation
```sh
$ npm ci
$ npm run dev
```## Usage
```sh
$ http GET http:///homework-template.png?name=Константин Константинопольской&sex=m Authorzation:"Bearer:
```## CI and Delivery
This services gets automatically deployed to heroku upon push to the master. The docker image is built on [heroku's premises](https://devcenter.heroku.com/articles/build-docker-images-heroku-yml)
## How to create a new template
First, you have to create and svg image out of the mock-up. Here is an example using figma:
![Create an SVG using figma](https://user-images.githubusercontent.com/1592663/133264066-411ad45a-d4f4-4c18-a353-377a9c57a386.png)Second, convert it tu utf-8. for text to become readable by a human. In MacOS or Linux: `xmllint --format --encode utf-8 downloaded.svg > downloaded-readble.svg`
.Third, create a text template out of the SVG, using nonjucks [variable substitution](https://mozilla.github.io/nunjucks/templating.html#variables) and [condigitional tags](https://mozilla.github.io/nunjucks/templating.html#if). Place the resulting file to the templates/ folder and voila!