- (lambda server (host port routes)
- (var http-server (new (. (require "http") Server)))
- (http-server.on "request" (lambda (req res)
- (./util/router (?: (instanceof routes Function) (routes) routes)
- req res)))
- (http-server.listen port)
- (var socket-server (new (. (require "ws") Server) (object "server" http-server)))
- (socket-server.on "connection" (lambda (socket) (./util/connected routes socket)))
- (return (object
- "http" http-server
- "sockets" socket-server)))
|