Giter Site home page Giter Site logo

doc-generator's Introduction

Document generator

This is a simple service to generate documents by a template.

Deploy

Docker

makedir doc-templates
# put templates in doc-templates dir
npm run docker

Usage

Template engine

See here

Environment config

# port to host the service on
PORT=3000

# folder with templates
TEMPLATE_PATH=./doc-templates

API

## List templates
curl "http://localhost:3000/templates"

## Generate document
curl -X "PUT" "http://localhost:3000/generate/template_name.docx" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "includeText": false,
  "first_name": "John",
  "last_name": "Doe"
}' -o result.docx

## Generate document from provided docx file
## The following exmaple DOES NOT work AS IS. You need to provide a docx template in the template part of the req
curl -X "POST" "http://localhost:3000/generate" \
     -H 'Content-Type: multipart/form-data; charset=utf-8; boundary=__X_PAW_BOUNDARY__' \
     -F "template=" \
     -F "values={\"first_name\":\"John\",\"last_name\":\"Doe\",\"includeText\":false}"

doc-generator's People

Contributors

nchursin avatar

Watchers

 avatar  avatar

doc-generator's Issues

Configuration UI

Admin should have a one-stop page to configure the app

Admin - is a tech user. Should have a dedicated perm set

Handle errors

Currently, any error falls back to default code 500. This should be changed.

Cases:

  • POST /generate - file is missing
  • POST /generate - file is not docx
  • POST /generate - values are missing
  • PUT /generate/:templateId - template not found
  • PUT /generate/:templateId - values are missing

Migrate this to be a monorepo

this project should be a monorepo, containing:

  1. doc generating server
  2. salesforce app

This should make overall version management easier

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.