#lang rhombus/static import: lib("web-server/http.rkt") open lib("web-server/servlet.rkt") open lib("web-server/servlet-env.rkt") open "thread/thread.rhm" open "src/world.rhm" fun start(req): println(#{request-method}(req)) println(#{request-post-data/raw}(req)) #{response/xexpr}("Hello world!") fun loop(): println("Hello World!") sleep(1) loop() fun sim_world(): let wrld = world.World() wrld.simulate() println("Creating thread") def thr: thread(sim_world) // Create webserver #{serve/servlet}(start, #{#:launch-browser?}: #false, #{#:servlet-path}: "/game") // Wait on world simulation thread so we don't kill the world before it has cleanly exited thread_wait(thr)