Placeholder Image Service
A service (web && CLI) to generate placeholder images with an intuitive API.
/png/400x300/color/ff0099
/png/400x300/search/flower
Table of Contents
About
A service to generate placeholder images. This project is only for fun and learning purposes.
Possible features will be:
- a UI to configure the placeholder over a form
- save all generated image-URLs in a db
Install
yarn install
Api
Start the server (e.g. yarn run server:single
) and then go to:
http://localhost:8000/api-docs
Usage
You can use it on CLI and web based.
The generated images are stored in:
public/image-store
CLI based
![]() |
---|
node src/cli/index.js /jpg/400x40/color/ff9900 |
Web based
Start the server (e.g. yarn run server:start
) and then go to one of these URLs:
![]() |
---|
http://localhost:8000/placeholder |
1x1 pixel image in gray, resized with img-attributes |
![]() |
---|
http://localhost:8000/jpg/400x200 |
![]() |
---|
http://localhost:8000/png/400x200/color/ff0099 |
![]() |
---|
http://localhost:8000/png/400x200/search/nature+tree |
This image is from pixabay and you need an account to get your own API-key.
Copy the src/api/pixabay.api-key.blank.json
to src/api/pixabay.api-key.json
and add your key inside.
Test
yarn test
Server
Start the server with yarn run server:single
Or use the following pm2
(Process Manager 2) based run scripts, with an built-in load balancer. // ;-)
Start
yarn run server:start
Stop
yarn run server:stop
Restart
yarn run server:restart
Logs
yarn run server:stop
Node.js CI - Github action
The used npm github-action needs an package-lock.json.
Thats why we have to keep yarn.lock
and Node.js CI package-lock.json
in sync at the moment.