Sign inSign up

unocha/hdx-snap-service

By unocha

•Updated almost 7 years ago

Snap service for HDX

Image
1

1.9K

unocha/hdx-snap-service repository overview

⁠HDX Snap Service

⁠Installing

  1. Clone repo
  2. npm install
  3. npm run start

⁠Usage

  1. Check service is running by performing GET on /ping
  2. Snap a website by making a GET request on /png with the following parameters:
    1. url - mandatory - url of the website, eg. /png?url=http://google.com
    2. fileName - optional - resulting file name, eg. /png?url=http://google.com&fileName=google.png
    3. selector - optional - snap only a part of the website described by a selector, eg. to get only the google logo by targeting element with id #hplogo: /png?url=http://google.com&selector=%23hplogo
    4. viewport - optional - provide optional parameters to alter snap service viewport, documentation here⁠ - eg. set width to 1280 and height to 1 (symbolic, will snap the whole page anyway) to : /png?viewport={"width":1280,"height":1}&url=http://google.com
    5. timeout - optional - set page load timeout during snapshot, eg. wait 60 seconds : /png?timeout=60000&url=http://google.com

⁠Development

  1. Clone repo
  2. npm install
  3. npm install -g nodemon
  4. npm run develop

To build the Docker image: docker build --no-cache -t hdx-snap-service:latest . To start it: docker run -d --name hdx-snap-service --shm-size=1G --cap-add=SYS_ADMIN -p 8080:80 hdx-snap-service:latest Start with path mapping: docker run -d --name hdx-snap-service --shm-size=1G --cap-add=SYS_ADMIN -v <PATH_TO_YOUR_DEV_DIR>:/srv/www -p 8080:80 hdx-snap-service:latest

Tag summary

Content type

Image

Digest

Size

240.7 MB

Last updated

almost 7 years ago

docker pull unocha/hdx-snap-service:1.1.3