by rsp



Example for Stack Overflow answer:

It is a server that serves a page that changes color when a new color is sent in a request to a POST /color endpoint.

Deploy to Heroku

Click this button to deploy this app to Heroku:

Deploy to Heroku


Clone the git repo:

git clone

or download the ZIP file:

Inside the project directory install dependencies:

npm i


Start the server:

npm start

And access the URL shown in the browser. By default it's:

but you can start the server listening on a differet port:

PORT=4444 npm start

Changing color

Send color=HTMLCOLOR in the body with Content-Type: application/x-www-form-urlencoded to POST /color endpoint:

curl -X POST -d color=#2ecc71 http://localhost:3338/color

curl -X POST -d color=#639 http://localhost:3338/color

curl -X POST -d color=black http://localhost:3338/color

Or using a GET /color/:color endpoint for convenience:

curl -X http://localhost:3338/color/+2ecc71

curl -X http://localhost:3338/color/+639

curl -X http://localhost:3338/color/black

Note the + instead of #.


For any bug reports or feature requests please post an issue on GitHub.


Rafał Pocztarski
Follow on GitHub Follow on Twitter
Follow on Stack Exchange


MIT License (Expat). See for details.