Simple REST API Server which always respond 200 OK.
The docker container which is run from this image start nodejs http server and respond 'application/json' payload.
Pull nmatsui/hello-world-api
from DockerHub:
$ docker pull nmatsui/hello-world-api
Or build nmatsui/hello-world-api
from Dockerfile:
$ git clone https://github.com/nmatsui/hello-world-api.git
$ cd hello-world-api
$ docker build -t nmatsui/hello-world-api .
-
start container
$ docker run -d --rm -p 3000:3000 nmatsui/hello-world-api
-
call REST API
$ curl -i http://localhost:3000/ HTTP/1.1 200 OK Content-Type: application/json Date: Sat, 21 Apr 2018 00:56:01 GMT Connection: keep-alive Transfer-Encoding: chunked {"message":"hello world!"}
-
If you want to change message or listening port, give the 'MESSAGE' or 'PORT' environment variable
$ docker run -d --rm -p 8888:8888 -e MESSAGE="FOO BAR" -e PORT="8888" nmatsui/hello-world-api
$ curl -i http://localhost:8888/any/path HTTP/1.1 200 OK Content-Type: application/json Date: Sat, 21 Apr 2018 00:57:25 GMT Connection: keep-alive Transfer-Encoding: chunked {"message":"FOO BAR"}
Copyright (c) 2018 Nobuyuki Matsui nobuyuki.matsui@gmail.com