From e3d5b9b101521dbcdfaf2dd18373d64ad3f1defd Mon Sep 17 00:00:00 2001 From: Daniel Polito Date: Mon, 25 Jan 2021 12:09:28 -0300 Subject: [PATCH] Tweaks --- README.md | 7 ++++--- kool.yml | 2 +- pdf-service.js | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1f35da4..30666a9 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ If you use Docker Compose (hopefully with [`kool`](https://github.com/kool-dev/k ```yml pdf: image: "kooldev/pdf:1.0" - expose: - - 3000 + ports: + - "3000:3000" ``` - After starting the service containers (with either `kool start` or `docker-compose up -d`), you can already start using the microservice to make PDFs! Example using PHP: @@ -20,7 +20,8 @@ If you use Docker Compose (hopefully with [`kool`](https://github.com/kool-dev/k ```php use GuzzleHttp\Client; -$pdf = (new Client())->post('http://pdf_dev/from-html', [ +// the hostname is the docker-compose service name, or an alias you add to your docker network +$pdf = (new Client())->post('http://pdf:3000/from-html', [ 'form_params' => [ 'html' => '

This is my super kool HTML that I want to turn into an awesome PDF file!

This is a very silly example, but you get the idea of how powerful this is :)

', 'options' => json_encode([ diff --git a/kool.yml b/kool.yml index 3b8f401..b9dc3a9 100644 --- a/kool.yml +++ b/kool.yml @@ -2,4 +2,4 @@ scripts: yarn: kool docker node:14-alpine yarn build: - - docker build --no-cache -t kooldev/pdf:latest -f Dockerfile.dist . + - docker build --no-cache -t kooldev/pdf:latest . diff --git a/pdf-service.js b/pdf-service.js index 203023c..ef0cf3f 100644 --- a/pdf-service.js +++ b/pdf-service.js @@ -155,7 +155,7 @@ function generateFileName() { } function log(message) { - let date = (new Date).toLocaleString(); + let date = new Date().toISOString().replace('T', ' ').substr(0, 19) console.log(`[${date}] ${message}`); }