# Mummy [guzba/mummy](https://github.com/guzba/mummy) - HTTP and WebSocket server (in nim) [TOC] ## My Notes - 30 Jan 2023 try build http server. [code here](https://github.com/me7/nimcode/blob/master/meMummy.nim) - use [webby]() to get searchParams => echo parseUrl(req.uri).query["foo"] ## Summary from readme - good because using thread (not async) - built in websocket server - not good for serve big file (send in-memory response) - request/sec = 9.5kMummy 9.6kJester 9.1kGo 8.5kNode ## [API](https://nimdocs.com/guzba/mummy/mummy.html) - setup = newServer, serve, close - http = response - ws = send, upgradeToWebSocket, hash ## [example](https://github.com/guzba/mummy/tree/master/examples) - basic = set router, newServer(router).serve - handler(req) => req.respond(code, header, content) - router.get("/", handler) - newServer(router).serve(Port(8000)) - database = use guzba/waterpark for sqlite pool - router = import mummy/routers - websocket = upgrade + handler - router.get("/ws", upgradeHandler) - proc upgradeHandler() => req.upgradeToWebSocket() - proc webSocketHandler(ws, event, msg) - chat => use HashSet and Lock - headers (cookie) - logging to file => newServer(handler, logHandler) - [nimdocs](https://github.com/treeform/nimdocs/tree/ryan) = automatic nim doc generator
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up