about summary refs log blame commit diff stats
path: root/src/io/about.nim
blob: b852c5562a45597228b3132f0e489391cabaf19f (plain) (tree)
1
2
3
4
5
6
7
8
9






                    
                                          
                     



                                                    


                                     
                                         

                                        

                            
                                         
                           
                         



                      
import streams
import tables

import io/request
import ips/serialize
import types/url

const chawan = staticRead"res/chawan.html"
const HeaderTable = {
  "Content-Type": "text/html"
}.toTable()

proc loadAbout*(request: Request, ostream: Stream) =
  if request.url.pathname == "blank":
    ostream.swrite(0)
    ostream.swrite(200) # ok
    let headers = newHeaders(HeaderTable)
    ostream.swrite(headers)
  elif request.url.pathname == "chawan":
    ostream.swrite(0)
    ostream.swrite(200) # ok
    let headers = newHeaders(HeaderTable)
    ostream.swrite(headers)
    ostream.write(chawan)
  else:
    ostream.swrite(-1)
  ostream.flush()