Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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!