Sign inSign up

morststs/zeptohttpd

By morststs

•Updated 2 months ago

Lightweight HTTP server

Image
Web servers
1

994

morststs/zeptohttpd repository overview

⁠overview

It is a lightweight HTTP server and is intended for use during development and operation checks. It has the following features

  • Returns a hello page by default when accessing the root path.
  • Returns the static web content of the host (requires directory bind mount). (Requires bind-mounting of the directory)
  • Returns the configured Content-Type for queries on arbitrary paths (requires bindmount of configuration file). (Requires bindmount of configuration file)

source : https://github.com/morststs/zeptohttpd⁠

⁠How to use

⁠A simple hello page

$ docker run --rm -d -p 80:80 --name zeptohttpd morststs/zeptohttpd
$ curl http://localhost:
<!DOCTYPE html>
<html lang="ja">

<head>
    <title>index page</title>
    <meta charset="utf-8">
</head>

<body>
    Hello World
</body>

</html>

⁠Displaying static content from a host

Prepare static content in the public directory on your host.

$ docker run --rm -d -p 80:80 -v ./public:/public --name zeptohttpd morststs/zeptohttpd

⁠Returns the set Content-Type.

$ cat -n config.json 
     1  {
     2      "ContentTypes": {
     3          "/api/": "application/json"
     4      }
     5  }
$ cat -n public/api/getData 
     1  {"key":"value"}
$ docker run --rm -d -p 80:80 -v ./public:/public -v ./config.json:/config.json --name zeptohttpd morststs/zeptohttpd
$ curl -D - -X POST http://localhost:/api/getData
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 16
Content-Type: application/json
Last-Modified: Sat, 24 Aug 2024 09:13:05 GMT
Date: Sun, 25 Aug 2024 02:39:20 GMT

{"key":"value"}
$ curl -D - -X GET 'http://localhost:/api/getData?val1=1&val2=2'
HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Length: 16
Content-Type: application/json
Last-Modified: Sat, 24 Aug 2024 09:13:05 GMT
Date: Sun, 25 Aug 2024 01:01:15 GMT

{"key":"value"}

Tag summary

Content type

Image

Digest

sha256:f9d60e44d…

Size

2.5 MB

Last updated

2 months ago

docker pull morststs/zeptohttpd