about summary refs log tree commit diff stats
path: root/adapter/protocol/about.nim
blob: 4f6dc97be5e19378dd7615d92f34c59774c96fc4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
when NimMajor >= 2:
  import std/envvars
else:
  import std/os

const chawan = staticRead"res/chawan.html"
const license = staticRead"res/license.md"

template printPage(s, t: static string) =
  stdout.write("Content-Type: " & t & "\n\n")
  stdout.write(s)

proc main() =
  case getEnv("MAPPED_URI_PATH")
  of "blank": printPage("", "text/plain")
  of "chawan": printPage(chawan, "text/html")
  of "license": printPage(license, "text/markdown")
  else: stdout.write("Cha-Control: ConnectionError 4 about page not found")

main()